Re: charset issue on Windows help needed

2014-09-11 Thread zz
On Thursday 11 September 2014 07:14:54 Emmanuel Thomas-Maurin wrote:
 I've had a similar problem previously, with non-ascii (for instance 
 cyrillic) user names in app data dir on windows. The trick was to use 
 'wide char' win32 API functions which all return UTF-16 encoded strings, 
 then convert to UTF-8 (with g_utf16_to_utf8()).
 
 
 On 09/11/2014 03:25 AM, Fernando Rodriguez wrote:
  On Wednesday 10 September 2014 5:07:03 PM Fernando Rodriguez wrote:
  On Wednesday 10 September 2014 7:37:28 PM Geert Janssens wrote:
  Hi,
 
  I'm stuck on the following issue. Program is GnuCash on Windows.
 
  Consider the following code snippet:
 
  struct stat statbuf;
  gchar* dirname = g_strdup(g_getenv(GNC_DOTGNUCASH_DIR);
  gint rc = g_stat (dirname, statbuf);
 
  switch (errno)
  {
 
 case ENOENT:
   // Directory doesn't exist
   // Here is code to create it which I cut for brevity
   break;
 
 case EACCES:
   // Directory can't be accessed
   exit(1);
 
 case ENOTDIR:
   // Not a directory
   exit(1);
 
 default:
   // Unknown error
   exit(1);
 
  }
 
  // Continue code with valid, existing directory
  ...
 
  So this snippet reads the value of environment variable GNC_DOTGNUCASH_DIR
  and tests whether this is a valid directory.
 
  This works fine when GNC_DOTGNUCASH_DIR uses a limited character set like
  ascii. For example when set to c:\gcdev\geert this works well and the
  code continues.
 
  However if set to for example:
  c:\gcdev\Łukasz
  Things go wrong (note the unusual Ł).
 
  In this case the code branches into case ENOENT and creates a directory
  named c:\gcdev\Lukasz (note the plain L now)
  Before it continues.
 
  Setting a breakpoint at rc=g_stat... and examining the value of dirname at
  that point also shows it to have a value of c:\gcdev\Lukasz (with plain
  L).
 
  So it seems I'm losing diacritical information here and I can't pass the
  right directory to my code to use.
 
  What should I do to get the real value from the environment to be able to
  access the true directory ?
 
  Thanks,
 
  Geert
 
  P.S. my locale settings are all Dutch_Belgium.1252 except for LC_ALL
  which is empty. ___
  gtk-app-devel-list mailing list
  gtk-app-devel-list@gnome.org
  https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
 
  Well gchar is a typedef for char so it only supports ascii. I think you'll
  probably have to use Win32 API calls on Windows to access multibyte file
  names.
 
  Also according to the documentation you should use GStatBuf instead of
  struct stat on Windows to get consistent behaviour on different compilers.
 
 
 
  ___
  gtk-app-devel-list mailing list
  gtk-app-devel-list@gnome.org
  https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
 
  Actually try using g_utf8_strncpy() instead of g_strdup(). I'm not sure if
  that'll get you all the way as the docs say g_stat calls the standard 
  library
  functions and AFAIK those dont support unicode/multibyte filenames.
 
 
 
  ___
  gtk-app-devel-list mailing list
  gtk-app-devel-list@gnome.org
  https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
 
 
 
 
Hi,
take a look at this code, maybe it helps:

ZZ

char *file_selector(char *title, GtkFileChooserAction fs_action, gboolean 
local_only, gboolean show_hidden, 
char *name, char *folder, char 
*shortcut_folder)
{
GtkWidget *dialog;
char *tmp;
char *filename = NULL;;


tmp = g_locale_to_utf8((title) ? title : , -1,NULL,NULL,NULL);
dialog = gtk_file_chooser_dialog_new (tmp,
/*parent_window*/ NULL,
fs_action,
GTK_STOCK_CANCEL, 
GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, 
GTK_RESPONSE_ACCEPT,
NULL);
xfree(tmp);

gtk_file_chooser_set_local_only(GTK_FILE_CHOOSER(dialog), local_only);
gtk_file_chooser_set_show_hidden(GTK_FILE_CHOOSER(dialog), show_hidden);

/* Returns a GsList *, not a char * */
/*gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dialog), 
select_multiple);*/

if (name) {
tmp = g_locale_to_utf8((name) , -1,NULL,NULL,NULL); 
gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(dialog), 
tmp);
xfree(tmp);
}

if (folder) {
tmp = g_locale_to_utf8((folder) , -1,NULL,NULL,NULL);   
gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), 
tmp);
xfree(tmp);
}

if (shortcut_folder) {
tmp = g_locale_to_utf8((shortcut_folder) , -1,NULL,NULL

Re: Segmentation fault in creating basic app using GTK+ (with C)

2014-07-14 Thread zz
On Tuesday 01 July 2014 10:39:03 Anoop Neem wrote:

Hi,
try:
p-two = label = gtk_label_new(a);
p-one = textEntry = gtk_entry_new()

hope this helps,
zz
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: GTK+2 - GtkFileChooserButton shows (none) as selected folder and crashes

2013-10-20 Thread zz
On Friday 18 October 2013 21:43:27 Alessandro Francesconi wrote:
 Some of my application’s users declare a strange problem with a particular 
 widget: GtkFileChooserButton.
 
 
 I needed to provide a way to select a single folder, so I used the widget 
 this way:
 
 
 GtkWidget* button_outfolder = gtk_file_chooser_button_new(_(Select output 
 folder), GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
 output_folder_string = 
 gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(button_outfolder)); // store 
 the default value
 gtk_widget_set_size_request(button_outfolder, 180, 30);
 
 
 
 
 The problem is that, when the widget is displayed for the first time, it 
 shows the text “(none)” instead of a default folder’s name. When the user 
 clicks on it to select a valid path, the entire program crashes with a 
 segfault (I can’t provide further information right now).
 
 
 This thing does not happen to everyone: for example, I’ve never seen this 
 behaviour with my systems (Windows 7/8, 64bit, GTK+ 2.22 and Linux 64bit with 
 GTK+ 3), but some other users with apparently the same environments are 
 experiencing it.
 
 
 I tried to workaround this issue by forcing the default folder at startup 
 with:
 
 
 gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(button_outfolder), );
 
 
 Nothing to do, the problem remains for “someone”.
 
 
 Did anyone ever experience this bug? Is it reported somewhere? Am I doing 
 something wrong in my code?
 
 
 
 
 Thank you!
 
 Ale

Hi,
this worked for me on xp and win7.


if (folder) {
tmp = g_locale_to_utf8((folder), -1, NULL, NULL, NULL);
gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), 
tmp);
g_free(tmp);
}


Ciao,
zz
___
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-23 Thread zz
On Sunday 23 June 2013 20:05:00 Kip Warner wrote:
 On Sun, 2013-06-23 at 11:51 +0200, David Nečas wrote:
  So how exactly does the behaviour of my simple example differ from what
  you want?  The widget fills the allocated space and the image scales,
  keeping the aspect ratio.
 
 When the parent window is resized, I'd like the image to scale to fill
 the allocated space as much as possible, maintaining the aspect ratio.
 My code draws the image correctly, but it doesn't resize as the parent
 window is resized:
 
 http://pastebin.com/6LEzFk8A
 
 

Hi,
maybe adding a callback to a window signal and redraw the image could be an 
option?

take a look at http://zetcode.com/tutorials/gtktutorial/gtkevents/

gtk_widget_add_events(GTK_WIDGET(window), GDK_CONFIGURE);

The event mask of the widget determines, what kind of event will a particular 
widget receive.
Some event are preconfigured, other events have to be added to the event mask.
The gtk_widget_add_events() adds a GDK_CONFIGURE event type to the mask.
The GDK_CONFIGURE event type accounts for all size, position and stack order 
events.

 g_signal_connect(G_OBJECT(window), configure-event,
 G_CALLBACK(your_callback), NULL);


Just an idea.

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

Re: open an existing file in buffer and write on it

2013-01-30 Thread zz
On Tuesday 29 January 2013 22:47:57 Rudra Banerjee wrote:
 I tried a lot(trying to understand the huge GLib as suggested by
 Andrew), but most of the discussion here went way beyond my capability.
 So, lets try from fresh.
 
 My code for treeview and editing the treeview column (column Id #1). So,
 once the column is edited, its updated by the cell_edited. Now, I need
 to put this new_text in the file as well. 
 The file that is read is a bibtex file (http://www.bibtex.org/Format/)
 
 GtkWidget *create_view_and_model(void) {
 GtkCellRenderer *cell;
 void
 cell_edited(GtkCellRendererText *renderer,
 gchar *path,
 gchar *new_text,
 GtkTreeView *treeview);
 
   store = gtk_list_store_new (NUM_COLS, G_TYPE_STRING, G_TYPE_STRING,
 G_TYPE_STRING, 
 G_TYPE_STRING, 
 G_TYPE_STRING);
 
   tree = gtk_tree_view_new_with_model (GTK_TREE_MODEL (store));
   gtk_tree_view_set_rules_hint (GTK_TREE_VIEW(tree), TRUE);
 
 
 /* #1: KEY COLUMN */  
   cell = gtk_cell_renderer_text_new ();
   g_object_set (cell,
 editable, TRUE,
 NULL);
   g_signal_connect (cell, 
   edited,G_CALLBACK(cell_edited), 
   tree);
   g_object_set_data (G_OBJECT (cell), 
   column, GINT_TO_POINTER (COL_BIB_KEY));
 
   GtkTreeViewColumn *col_key,*col_year,*col_type,*col_auth,*col_pub;
   col_key=gtk_tree_view_column_new_with_attributes (
   Key, cell,
   text, COL_BIB_KEY,
   NULL);
   gtk_tree_view_column_set_sort_column_id( col_key, ID_KEY);
   gtk_tree_view_append_column (GTK_TREE_VIEW (tree), col_key);
   gtk_tree_view_column_set_max_width  (col_key,100);
 
 
 /* #2: TYPE COLUMN */  
   cell = gtk_cell_renderer_text_new ();
 
   col_type=gtk_tree_view_column_new_with_attributes (
Type, cell,
text, COL_BIB_TYPE,
NULL);
   gtk_tree_view_column_set_sort_column_id( col_type, ID_TYPE);
   gtk_tree_view_append_column (GTK_TREE_VIEW (tree), col_type);
 
 
 /*
 Three more such column of treeview
 */
 
 return tree;
 }
 
 
 /* Apply the changed text to the cell if it is not an empty string. */
 void cell_edited(GtkCellRendererText *renderer,
 gchar *path,
 gchar *new_text,
 GtkTreeView *treeview)
 {
   guint column;
   GtkTreeIter iter;
   GtkTreeModel *model;
   gpointer columnptr = g_object_get_data(G_OBJECT(renderer), column);
   column = GPOINTER_TO_UINT(columnptr);
 
 
   if (g_ascii_strcasecmp (new_text, ) != 0)
   {
 model = gtk_tree_view_get_model (treeview);
 if (gtk_tree_model_get_iter_from_string (model, iter, path))
   gtk_list_store_set (GTK_LIST_STORE (model), iter, column,
 new_text, -1);
  }
 }
 Kindly Help.
 

Take a look at:

http://www.gerd-neugebauer.de/software/TeX/BibTool/

this bibtool seems to be able to manipulate bibtex file fields.
So you maybe can call it from your program with the correct args
or take a look at the source to see how things are done.

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


Re: open an existing file in buffer and write on it

2013-01-25 Thread zz
On Friday 25 January 2013 14:57:23 Rudra Banerjee wrote:
 Dear friends,
 as evident from my last few posts, I am struggling with opening a file
 as buffer and write to it
 (guess it has *nothing* to do with gtk, but C. Still I will be grateful
 if you people kindly help). 
 So, first, how to open file in buffer?
 
 /* Files opened and edited directly*/
 /*  FILE *fop = fopen(filename, a );
   if (!fop){
 filename=Untitled.bib;
 fop= fopen(filename,a);
   }
 */  
 
 /*Trying to open file as buffer and edit that*/
   FILE *fopf = fopen(filename, a );
   if (!fopf){
 filename=Untitled.bib;
 fopf= fopen(filename,a);
   }


You have to open, read  (and then close) the file into a static or malloced 
buffer of sufficient size,
then you can operate on the buffer. When your are done you write out the buffer
to a newfile, delete the old and rename the new to old.

   char fop[]=Hello World;
   int buf_size= strlen(fop)+1;
   fwrite(fop,buf_size,1,fopf);
   if(!fop){
 printf(failed);
   }
   fclose(fopf);
 
   gtk_label_set_text(GTK_LABEL(flabel), filename);
 printf( fop, @%s{%s,\n, strcombo, strkey );
   if( strlen(strAuth)!=0)
 printf( fop, \tAuthor=\%s\,\n, strAuth);
   if( strlen(strEditor)!=0)
 printf( fop, \tEditor=\%s\,\n, strEditor);
   if( strlen(strTitle)!=0)
 printf( fop, \tTitle=\%s\,\n, strTitle);
 //  fclose(fop);
 
 
 The very first part of the code (commented) used to access the file
 directly, an approach that I was advised against. So I tried to open the
 file in buffer. But this implementation makes the program crash as soon
 as enter some value. 
 
 Please help
 

PS.: at the first glance it seems to me you need a database backend
like sqlite to save, store, change and retrieve your data.

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


Re: edit and use treeview cell

2013-01-24 Thread zz
On Thursday 24 January 2013 11:02:37 Rudra Banerjee wrote:
 On Thu, 2013-01-24 at 10:45 +0100, David Nečas wrote:
  Have you read the tutorial?
  
  http://scentric.net/tutorial/sec-editable-cells.html
 David,
 Thanks for your reply.
 Yes, I have read that tutorial. 
 After reading that I have learned how to make the cell editable. But the
 problem still confuses me. And also, as I said, how to use this.
  That tut says I need a function cell_edited_callback to make the edit
 in file. But bit clueless about how to do that.
 
 ___
 gtk-app-devel-list mailing list
 gtk-app-devel-list@gnome.org
 https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Hi,
i used something like that in gtk2 and it used to work,
hope it helps and is understandable as my code is sometimes
a little bit convoluted as I'm self-taught,

Ciao,
ZZ

static void list_edited(GtkCellRendererText * cell, gchar * path_string, gchar 
* new_text, gpointer user_data)
{
GtkTreeView *treeview = (GtkTreeView *)user_data;
GtkTreeModel *model;
GtkTreeIter iter;
guint column;

/* Column number is passed as renderer object data */
gpointer columnptr = g_object_get_data(G_OBJECT(cell), column);

column = GPOINTER_TO_UINT(columnptr);

/* Get the iterator */
model = gtk_tree_view_get_model(treeview);
gtk_tree_model_get_iter_from_string(model, iter, path_string);

/* Update the model */
gtk_list_store_set(GTK_LIST_STORE(model), iter, column, new_text, -1);
}

static void text_editing_started (GtkCellRenderer ATTRIBUTE_UNUSED *cell, 
GtkCellEditable *editable,
  const gchar *path, GCallback data)
{
debug_err_msg(%s: started, __FUNCTION__);

if (GTK_IS_ENTRY (editable)) {
GtkEntry *entry = GTK_ENTRY (editable);
GCallback cb_func = data;
g_signal_connect(GTK_OBJECT(entry), activate, 
(GCallback)cb_func, (char *)xstrdup(path));
}
}


GtkWidget *string_list_create(int num, GCallback func, int show_hide, int 
editable,...)
{
GtkCellRenderer *renderer;
GtkTreeViewColumn *column;
GtkListStore *store;
GtkWidget *tree;
GtkTreeSelection *selection;
GType *types;
va_list titles;
int i;
char *tmp;
char *label;
double align;

types = (GType *) malloc((num + 1) * sizeof(GType));
for (i = 0; i  num; i++) {
types[i] = G_TYPE_STRING;
}

store = gtk_list_store_newv(num, types);
xfree(types);
tree = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(tree), TRUE);
/* Setup the selection handler */
selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree));
gtk_tree_selection_set_mode(selection, GTK_SELECTION_SINGLE);

if (func) {
g_signal_connect(selection, changed, G_CALLBACK(func), NULL);
}
/* The view now holds a reference.  We can get rid of our own reference 
*/
g_object_unref(G_OBJECT(store));

va_start(titles, editable);
for (i = 0; i  num; i++) {
/* Create a cell renderer */
renderer = gtk_cell_renderer_text_new();

tmp = va_arg(titles, char *);
align = va_arg(titles, double);

if (editable == EDITABLE || (editable == CUSTOM  
va_arg(titles, int) == EDITABLE)) {
g_object_set(renderer,editable, TRUE, NULL);
g_object_set_data(G_OBJECT(renderer), column, 
GUINT_TO_POINTER(i));   
g_signal_connect(GTK_OBJECT(renderer), edited, 
G_CALLBACK(list_edited), tree);
if (editable == CUSTOM) {
g_signal_connect(GTK_OBJECT(renderer), 
editing-started, G_CALLBACK(text_editing_started),
(gpointer) va_arg(titles, void*));
}
}

if (!tmp || show_hide == HIDE ) tmp = ;

if (g_utf8_validate(tmp, -1, NULL) != TRUE) {
label = g_locale_to_utf8(tmp , -1, NULL, NULL, NULL);
/* Create a column, associating the text attribute of 
the  cell_renderer to the column of the model */
column = 
gtk_tree_view_column_new_with_attributes(label, renderer, text, i, NULL);
xfree(label);
} else {
column = gtk_tree_view_column_new_with_attributes(tmp, 
renderer, text, i, NULL);
}
g_object_set (renderer,xalign, align, NULL);
/* Add the column to the view. */
gtk_tree_view_append_column(GTK_TREE_VIEW(tree), column);
}
va_end(titles

Re: oops

2012-02-29 Thread zz
On Thursday 01 March 2012 04:05:22 Gary Kline wrote:
 On Wed, Feb 29, 2012 at 06:46:50PM -0800, Gary Kline wrote:
  Date: Wed, 29 Feb 2012 18:46:50 -0800
  From: Gary Kline kl...@thought.org
  Subject: oops
  To: GTK Devel List gtk-app-devel-list@gnome.org
  
  well, here's the story: i have a file that creates four hscale
  widgets.  0 to 100.  [optionally, four scrollbars that are in sync
  with the hscale widgets.  ok, the thing is: how do i capture the
  user's choice from these horizontal bars and save thedir values to a 
  config file?
  
  amybody?  i'm wedged.
  
  gary
  
   Sorry for this:: but is there such a thing as a save
   button option?  lets say that the user choses 23 for his
   pitch.  could i have a save button confirm and write that
   vsalue?? if so, how exactly?
 
   scratching my head...  -gk.
 
 
 
 
 

Hi,
gtk_adjustment_get_value () ?

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


Re: need help getting this right

2012-02-26 Thread zz
On Sunday 26 February 2012 00:28:34 Gary Kline wrote:
 i'll append ~130 lines of C and gtk v2.0 or later.  i found this
 online in a much busier [and complex] example.  for several days,
 on and off, i messed around trying to get two independent horizontal
 bars.  i would guess that in total, i hacked away around 17-23
 hours.  this morning i threw everything away and started from
 *scratch*.  after about two hours of using EXtreme care, i got to
 horizontal bars to work.
 
 (by the way, this is for part of my menu-items Options dropdown.
 i FINALLY found the program i had been looking for. Gespeaker.  i
 thought: Oh great; that's got all  i  need.  BUUUT: Bzzt: it is is
 python and i'm still learning that.  )
 
 what i need help w with is mostly =one=- thing: give the numbers more
 =room=.  only 0 and 100 are clear.  the rest are displayed as if
 torn [??]; i  would like lots of vertical space between my three or
 four horizontal bars.  i've tried the 'separator' bar.  no joy, at
 least AFAICT.
 
 thanks much in advance,
 
 gary
 
 
 

Hi,
gtk_widget_set_usize (GTK_WIDGET (hscale), 200, -1);

works for me.

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


Re: gtk 2.24 on Windows

2012-01-27 Thread zz
On Friday 27 January 2012 22:11:52 Allin Cottrell wrote:
 For a long time I've built the Windows version of my app against gtk 
 2.16 (and included the corresponding runtime in the app's 
 installer). After hearing of progress with gtk 2.24 on Windows I 
 thought I'd give that a try, so today I did a build using gtk 2.24.8 
 and friends from http://www.gtk.org/download/win32.php (updating 
 both runtime and dev).
 
 I then tried the new package on a Thinkpad T420s running Windows 7.
 Ouch! The app was basically unusable due to horrible painting 
 problems. The two most notable things, before I gave up, were:
 
 1) On first accessing a menu on the app's main menu bar it worked 
 fine, but on subsequent accesses the menu appeared totally blank: 
 you pull down a flat gray rectangle. This was the case for all the 
 main pull-down menus.
 
 2) On opening a window containing a treeview, the treeview is blank. 
 But if you move the mouse over the window this paints in the 
 content, line by line.
 
 Other sorts of window saw their contents appear and then disappear.
 
 Any ideas what's going on here? (The gtk 2.16 build works fine on 
 the same system.)
 
 
Hi,
i use the same gtk bundle on win 7 and everything works
(treeviews, menus, etc).
It was just more picky and exposed some little bugs I've done
mostly by abusing gtkentry private const char strings.
I also needed to force it to show icons in buttons
with a call in code to set the property as it did not want
to honour gtkrc. I use codeblocks as IDE and latest
Tdm-gcc as compiler (http://tdm-gcc.tdragon.net/download).
I also force glib to use libc's standard allocators
by calling this function at app start:

void my_mem_init(void)
{
GMemVTable gMemVTable;

gMemVTable.malloc  = malloc;
gMemVTable.realloc = realloc;
gMemVTable.free= free;
gMemVTable.calloc  = NULL;
gMemVTable.try_malloc  = NULL;
gMemVTable.try_realloc = NULL;
g_mem_set_vtable( gMemVTable );
}

Hope this helps.

Ciao,
Tito



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


Re: Strange glibc detected invalid pointer with gtk_entry

2011-07-05 Thread zz
On Tuesday 05 July 2011 14:24:48 Herbert Gasiorowski wrote:
 I have an issue with nearly all gtk+ programs: since about one week the 
 programs 
 crash at startup with some fault like this:
 
 *** glibc detected *** ./gtk-tab2: munmap_chunk(): invalid pointer: 
 0x01aa8eb0 ***
 === Backtrace: =
 /lib64/libc.so.6[0x365a47703a]
 /lib64/libglib-2.0.so.0(g_free+0x23)[0x365c449743]
 
 But if I start the program via ssh it runs as expected:
 ssh -X $HOSTNAME myprogram
 AND if I link without -lmcheck it is ok too ...
 
 I deleted all code which did not affect this issue:
 It is not much more than another Hello World example but using gtk_entry to 
 display the text (#if 1):
 
 Fedora 15 and gtk3-3.0.11-1.fc15.x86_64
 (gtk2 will fail too)
 
 Can someone tell me what I should do next?
 
 ==
 /* test with
   *  gcc -Wall -g -o gtk-tab gtk-tab.c -lmcheck `pkg-config --cflags --libs 
 gtk+-3.0`  ./gtk-tab
   */
 
 #include stdlib.h
 #include string.h
 #include gtk/gtk.h
 
 #define SUMMARY gtk test
 #define TRACE(l,fmt,args...) fprintf(stderr,#%03d#%9.9s:%3d#  
 fmt\n,l,__FILE__,__LINE__,##args)
 
 int main( int argc, char **argv ) {
   GtkWidget *window;
   GtkWidget *value;
   TRACE(9,gtk init);
   gtk_init (argc, argv);
 
   TRACE(12,gtk create a new window);
   window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
   gtk_window_set_title (GTK_WINDOW (window), SUMMARY);
   g_signal_connect (G_OBJECT (window), destroy,
   G_CALLBACK (gtk_main_quit), NULL);
   
   TRACE(12,Create the text);
 #if 1
   value = gtk_entry_new();
   gtk_entry_set_text( GTK_ENTRY(value), test 123 );
 #else
   value = gtk_label_new(test 123);
 #endif
 
   gtk_container_add (GTK_CONTAINER (window), value);
 
   TRACE(12,gtk show all);
   gtk_widget_show_all (window);
   TRACE(11,gtk loop: start);
   gtk_main ();
   TRACE(11,gtk loop: done);
   return 0;
 }
 ==

I in the past used this function this insert text in entry widgets, don't know 
if it helps in your case:

void my_gtk_entry_set_text(GtkEntry *entry, char *data)
{
char *tmp;

if (!data) data = ;

if (g_utf8_validate(data, -1, NULL) != TRUE) {
tmp = g_locale_to_utf8(data, -1, NULL, NULL, NULL); 
gtk_entry_set_text(entry, tmp);
xfree(tmp);
} else {
gtk_entry_set_text(entry, data);
}
}

Hope this helps.

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


Re: Strange glibc detected invalid pointer with gtk_entry

2011-07-05 Thread zz
On Tuesday 05 July 2011 16:19:00 Emmanuele Bassi wrote:
 On 2011-07-05 at 15:05, z...@excite.it wrote:
  void my_gtk_entry_set_text(GtkEntry *entry, char *data)
  {
  char *tmp;
  
  if (!data) data = ;
  
  if (g_utf8_validate(data, -1, NULL) != TRUE) {
  tmp = g_locale_to_utf8(data, -1, NULL, NULL, NULL); 
  gtk_entry_set_text(entry, tmp);
  xfree(tmp);
 
 
 agh!
 
 g_locale_to_utf8() returns memory allocated through the GLib API; you
 need to call g_free() to free it. *do not* mix GLib's memory allocation
 functions with other allocation functions.

Hi,
to be honest :-) I'm doing this for a long time and never experienced problems.
Cannot imagine glib calling something different than malloc/calloc/realloc at 
the low level
so unless there are some special profiler or debug functions free should be ok 
or at least
it for me worked flawlessly in linux and windows. I think there must be more 
than a simple no-no.
Thanks for your hint will try to correct this bad habit in the future.
To fix my code a simple

#define malloc g_malloc
#define free g_free
#define calloc  g_calloc
#define realloc g_realloc

should do it. Right?

Ciao,
Tito
 ciao,
  Emmanuele.
 
 
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: How to make a simple beep?

2009-03-10 Thread zz
On Tuesday 10 March 2009 07:35:35 Ardhan Madras wrote:
 Maybe here is not right place to ask such question. 
 
 Basically, you will need to open /dev/console, call ioctl to the device with 
 KIOCSOUND request (see linux/kd.h) and a integer that describes the freq. 
 Use delay (usleep, nanosleep, etc.), then use 0 as freq to stop the beep.
 
 --- ajhwb
 
 --- garthskidst...@gmail.com wrote:
 
 From: Garth's KidStuff garthskidst...@gmail.com
 To: gtk-app-devel-list@gnome.org
 Subject: How to make a simple beep?
 Date: Sun, 1 Mar 2009 07:38:14 -0800
 
 Hey All,
 
 I'm running under Ubuntu 8.10 and want to make a simple beep -- like the
 Windows Beep function which takes a frequency (in Hz) and a duration (in
 milliseconds).  Does anyone have a place to point me?
 
 TIA
 
 -Garth
 


Hi,

gdk_beep();


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


Gtkfilechooser question

2008-08-23 Thread zz
Hi,
i'm facing a problem in the use of the gtk_file_chooser_dialog.
I'm developing a frontend for an antivirus scanner
and i need to pass to the scanner the path of the file OR folder
to scan. At the moment due to the nature of the

GtkFileChooserAction
typedef enum
{
  GTK_FILE_CHOOSER_ACTION_OPEN,
  GTK_FILE_CHOOSER_ACTION_SAVE,
  GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
  GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER
} GtkFileChooserAction;

I solved the problem by adding two buttons to the gui 
one to select a file and one to select a folder.
This obviously is a suboptimal solution.
In the past i used a gtk_file_selection widget
for that function but i abandoned it as now it is deprecated.
After googling aroud a lot I tried various hacks to the gtk_file_chooser_dialog
by connecting to different signals and trying
to change the GtkFileChooserAction on the fly
with no result.
What I'm missing is a:

GTK_FILE_CHOOSER_ACTION_SELECT_FILE_FOLDER

action but i doubt the gtk people will implement
it for me :-).

I also started looking at the gtk_file_chooser
source to see if it is possible to implement 
a private version of the widget for my app
but this looks like a rather difficult task.
Any hints are welcome as i'm at a dead end now


Thanks in advance and best regards,
Tito
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Gtkfilechooser question

2008-08-23 Thread zz
On Saturday 23 August 2008 15:26:55 Martin (OpenGeoMap) wrote:
 Hi:
 
  GTK_FILE_CHOOSER_ACTION_SELECT_FILE_FOLDER
 
  action but i doubt the gtk people will implement
  it for me :-).
 

 I don`t see any reason to implement that in gtk. I believe you have 
 design your own widget
 
 Regards.
 
 
 
Hi,
In my opinion there would be some reasons to implement it
as this is a feature that could be useful in many cases.
The fact that this feature is missing is a needless limitation
to a tool that already has the capabilities to do that built in.
There are examples for the need of this feature also in other OSes:
the gui of Nero essentials pops up, after clicking on add,
a standard win file chooser dialog that allows to add files and/or folders.
The KDE open files dialog has it to...
I think there could be more examples
Last but not least the previous GtkFileSelection interface
had this feature already and after deprecating it in my
opinion it should be natural to offer in the replacement
interface at least the same features as in the previous.


Thanks for your response and best regards,
Tito

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


Re: Embedded Gtk+ system: HTML display

2008-07-21 Thread zz
Hi,
you could take a look at the old gtk1 based dillo web browser.
dillo is quite good for simple html like help or man pages.
You can find an enhanced version at

http://teki.jpn.ph/pc/software/index-e.shtml

Ciao,
ZZ

On Monday 21 July 2008 21:13:52 John Boncek wrote:
 In an embedded ARM-based system, HTML display is needed.  This does not
 include web browsing, just display of HTML documents.  There appears to be
 no solution readily available.
 
 I've done a lot of searching of the Internet.  The possibilities I've found
 are:
 
 
 1.  GtkMozEmbed
 
 This is apparently a widget that includes the entire Mozilla browser with
 Gecko engine, which sounds like a non-starter for a memory-constrained
 embedded system.
 
 
 2.  GtkHTML
 
 Described thus in the Gnome web pages:  The GtkHTML package contains a
 lightweight HTML  rendering/printing/editing engine. This is an evolution
 specific application at this time.
 
 No usage documentation.
 
 A little build documentation states the following dependencies:
 gnome-print = 0.25
 gdk-pixbuf = 0.8.0
 gal = 0.7.99.5
 pspell 
 bonobo = 0.32 
 GConf = 0.9   
 libghttp = 1.0
 libglade   
 Most of these we do not need and do not currently ship.
 
 The mailing list http://lists.ximian.com/mailman/listinfo/gtkhtml is
 mentioned in the README file of the GtkHTML download.  This list does not
 exist and I have found no other.
 
 
 Is there some other widget or library I have missed?
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: How to make gtktextview automatically scroll to cursor?

2008-05-19 Thread zz
On Monday 19 May 2008 13:23:39 Till Harbaum / Lists wrote:
 Hi,
 
 i have simple problem but hakf an hour of googling didn't give me an answer:
 
 How do i make an editable gtktextview inside a scrolledwindow to automatically
 scroll to the cursor position? 
 
 This must be a very basic issue and i am sure it is answered in various simple
 examples. But i just don't find one ...
 
 Till
 ___
 gtk-app-devel-list mailing list
 gtk-app-devel-list@gnome.org
 http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
 
 

Hi,
maybe this will help you:

if (autoscroll) {
model = gtk_tree_view_get_model(GTK_TREE_VIEW(tree));   
path = gtk_tree_model_get_path(GTK_TREE_MODEL(model), iter);
gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(tree), path, NULL, 
TRUE, 0.0, 0.0);
gtk_tree_path_free(path);
}

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


Re: How to make gtktextview automatically scroll to cursor?

2008-05-19 Thread zz
On Monday 19 May 2008 14:41:57 [EMAIL PROTECTED] wrote:
 On Monday 19 May 2008 13:23:39 Till Harbaum / Lists wrote:
  Hi,
  
  i have simple problem but hakf an hour of googling didn't give me an answer:
  
  How do i make an editable gtktextview inside a scrolledwindow to 
  automatically
  scroll to the cursor position? 
  
  This must be a very basic issue and i am sure it is answered in various 
  simple
  examples. But i just don't find one ...
  
  Till
  ___
  gtk-app-devel-list mailing list
  gtk-app-devel-list@gnome.org
  http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
  
  
 
 Hi,
 maybe this will help you:
 
   if (autoscroll) {
   model = gtk_tree_view_get_model(GTK_TREE_VIEW(tree));   
   path = gtk_tree_model_get_path(GTK_TREE_MODEL(model), iter);
   gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(tree), path, NULL, 
 TRUE, 0.0, 0.0);
   gtk_tree_path_free(path);
   }
 
 Ciao,
 ZZ

Sorry for the noise,
mis-read gtktextview as gtktreeeview

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


Re: Locale definitions, dots and commas

2008-03-12 Thread zz
On Wednesday 12 March 2008 17:31:32 Andrew W. Nosenko wrote:
 On Wed, Mar 12, 2008 at 6:09 PM, Carlos Pereira
 [EMAIL PROTECTED] wrote:
   Thanks for your answers, I realize this is not Gtk stuff,
   but certainly affects every GTK app involving decimal numbers...
 
   After setting in my .bashrc, for example (the same with portuguese,
   russian, etc.):
 
   LC_ALL=french; export LC_ALL
 
   Everything automatically works in my GTK app, with commas instead of
   dots, including exporting and importing files (involving for example the
   Expat XML library).
 
   However, a problem remains: my app is distributed with several hundreds
   of example data files, ready to be imported. If these files are
   dot-based, comma people cannot import them. If these files are
   comma-based, dot people cannot import them... Unless I have two versions
   for each file (which seems odd), or I supply a script to automatically
   convert dot- to comma-based files...
 
   If I use gtk_disable_setlocale, then dots are always used, but that does
   not seem quite right... basically I am ignoring user's preference for
   commas...
 
   Is there a good solution for this? am I missing something?
   What is the standard procedure in Gnome to handle this problem?
 
 Please, consider some rewirtting of your application to do not write
 locale-dependent values (floating point numbers, month abbrevs,
 day-of-week abbrevs, and so on...) in the data files, or your files
 will become unreadable after changing of locale (and, if I understand
 correctly, you already hit this problem).  Use some locale-independent
 variant instead.
 
 For case of the floating point values it could be dot-based variant as
 in the C locale.
 
 See g_ascii_dtostr() and/or g_ascii_formatd()  for
 formatting/serialization of double to string, and g_ascii_strtod()
 and/or g_strtod() converting back from string to double.
 

Maybe you can use some char based format as DECIMAL in mysql.

DECIMAL[(M[,D])] [UNSIGNED] [ZEROFILL]

For MySQL 5.0.3 and above:

A packed “exact” fixed-point number. M is the total number of digits (the 
precision) and D is the number of digits after the decimal point (the scale). 
The decimal point and (for negative numbers) the ‘-’ sign are not counted in M. 
If D is 0, values have no decimal point or fractional part. The maximum number 
of digits (M) for DECIMAL is 65 (64 from 5.0.3 to 5.0.5). The maximum number of 
supported decimals (D) is 30. If D is omitted, the default is 0. If M is 
omitted, the default is 10.

UNSIGNED, if specified, disallows negative values.

All basic calculations (+, -, *, /) with DECIMAL columns are done with a 
precision of 65 digits. 


so for example 123456,01 if you use as standard value DECIMAL(10,2) would be 
12345601.
This value could then be converted at runtime when imported to the correct 
decimal separator.

val = atoi(1234501) / 100;

Just an idea,
Tito

PS: sorry for the double post
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: GtkFileChooserDialog and GtkFileChooser problem

2007-11-13 Thread zz
On Monday 12 November 2007 23:24:51 [EMAIL PROTECTED] wrote:
 Hi,
 I'm experiencing a little problem with GtkFileChooserDialog and
 GtkFileChooser: I'm writing an app that needs to select a path to operate on
 it. This path could be a file or a directory (to be handled recursively).
 While it was possible to select a file OR a directory with the old
 GtkFileSelection widget it seems to be impossible to do the same
 thing with the new GtkFileChooserDialog and GtkFileChooser widgets
 as the GtkFileChooserAction(s) don't allow it:
  
 GTK_FILE_CHOOSER_ACTION_OPEN,
 GTK_FILE_CHOOSER_ACTION_SAVE,
 GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
 GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER
 
 Is there a way to force a GtkFileChooserDialog to be able to select
 files or directories?
 Am i overlooking the obvious?
 
 Best regards,
 Tito


Hell low. I'm not a professional, just a beginner, but i know dat's possible.
You know audacious audio player? Look, there s just watchu need. My advice 2 u
- look it's source n i think u'll find how they did it.

Peace.

I've looked at Audacity but in the last version it is not possible.
I think it depends on the gtk libs version.

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


GtkFileChooserDialog and GtkFileChooser problem

2007-11-12 Thread zz
Hi,
I'm experiencing a little problem with GtkFileChooserDialog and GtkFileChooser:
I'm writing an app that needs to select a path to operate on it.
This path could be a file or a directory (to be handled recursively).
While it was possible to select a file OR a directory with the old
GtkFileSelection widget it seems to be impossible to do the same
thing with the new GtkFileChooserDialog and GtkFileChooser widgets
as the GtkFileChooserAction(s) don't allow it:
 
GTK_FILE_CHOOSER_ACTION_OPEN,
GTK_FILE_CHOOSER_ACTION_SAVE,
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER

Is there a way to force a GtkFileChooserDialog to be able to select
files or directories?
Am i overlooking the obvious?

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


Re: Editing in GtkTreeView - Automatic Edit and Unwanted Edit Box?

2007-08-19 Thread zz
On Sunday 19 August 2007 18:34:32 David Nečas wrote:
 On Sun, Aug 19, 2007 at 05:16:49PM +0100, Tony Cowderoy wrote:
  
  First question - is there any (preferably easy) way with a GtkTreeView 
  to make any editable cell that is selected automatically enter edit mode 
  and automatically commit the changes when focus moves elsewhere?
 
 IIRC this is tricky to get right, so easy probably no.
 Hopefuly someone who has a working example will post it...
 
  Second - in the application that I'm trying to develop I have a 
  GtkTreeview with data in a GtkListStore and some, but not all, of the 
  cells editable.  If I have a cell selected, but not opened for editing 
  (this includes non-editable cells) and I then start typing, an editable 
  box appears in the bottom right-hand corner of the GtkTreeView, which 
  displays what I'm typing.  If I press enter, it goes away and the text 
  of the selected cell is not updated.  Does anyone know why this odd 
  behaviour is happening and what I can do to stop it?
 
 I suppose it's the search box.  In such case:
 
   gtk_tree_view_set_enable_search(treeview, FALSE);
 
 (or set the corresponding property).
 
 Yeti
 
 --
 http://gwyddion.net/
 ___
 gtk-app-devel-list mailing list
 gtk-app-devel-list@gnome.org
 http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
 

Hi,
this should do something similar to what you are looking for:


static void list_edited(GtkCellRendererText * cell, gchar * path_string, gchar 
* new_text, gpointer user_data)
{
GtkTreeView *treeview = (GtkTreeView *)user_data;
GtkTreeModel *model;
GtkTreeIter iter;
guint column;

/* Column number is passed as renderer object data */
gpointer columnptr = g_object_get_data(G_OBJECT(cell), column);

column = GPOINTER_TO_UINT(columnptr);

/* Get the iterator */
model = gtk_tree_view_get_model(treeview);
gtk_tree_model_get_iter_from_string(model, iter, path_string);

/* Update the model */
gtk_list_store_set(GTK_LIST_STORE(model), iter, column, new_text, -1);
}

static void text_editing_started (GtkCellRenderer ATTRIBUTE_UNUSED *cell, 
GtkCellEditable *editable,
  const gchar *path, GCallback data)
{
debug_err_msg(%s: started, __FUNCTION__);

if (GTK_IS_ENTRY (editable)) {
GtkEntry *entry = GTK_ENTRY (editable);
GCallback cb_func = data;
g_signal_connect(GTK_OBJECT(entry), activate, 
(GCallback)cb_func, (char *)xstrdup(path));
}
}


GtkWidget *string_list_create(int num, GtkSignalFunc func, int show_hide, int 
editable,...)
{
GtkCellRenderer *renderer;
GtkTreeViewColumn *column;
GtkListStore *store;
GtkWidget *tree;
GtkTreeSelection *selection;
GType *types;
va_list titles;
int i;
char *tmp;
char *label;
double align;

types = (GType *) malloc((num + 1) * sizeof(GType));
for (i = 0; i  num; i++) {
types[i] = G_TYPE_STRING;
}

store = gtk_list_store_newv(num, types);
xfree(types);
tree = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(tree), TRUE);
/* Setup the selection handler */
selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree));
gtk_tree_selection_set_mode(selection, GTK_SELECTION_SINGLE);

if (func) {
g_signal_connect(selection, changed, G_CALLBACK(func), NULL);
}
/* The view now holds a reference.  We can get rid of our own reference 
*/
g_object_unref(G_OBJECT(store));

va_start(titles, editable);
for (i = 0; i  num; i++) {
/* Create a cell renderer */
renderer = gtk_cell_renderer_text_new();

tmp = va_arg(titles, char *);
align = va_arg(titles, double);

if (editable == EDITABLE || (editable == CUSTOM  
va_arg(titles, int) == EDITABLE)) {
g_object_set(renderer,editable, TRUE, NULL);
g_object_set_data(G_OBJECT(renderer), column, 
GUINT_TO_POINTER(i));   
g_signal_connect(GTK_OBJECT(renderer), edited, 
GTK_SIGNAL_FUNC(list_edited), tree);
if (editable == CUSTOM) {
g_signal_connect(GTK_OBJECT(renderer), 
editing-started, GTK_SIGNAL_FUNC(text_editing_started),
(gpointer) va_arg(titles, void*));
}
}

if (!tmp || show_hide == HIDE ) tmp = ;

if (g_utf8_validate(tmp, -1, NULL) != TRUE) {
label = g_locale_to_utf8(tmp , -1, NULL, NULL, NULL);
/* Create a column, associating the text attribute of 
the 

Re: SIGINT with gtk_main

2007-03-21 Thread zz
On Wednesday 21 March 2007 18:50:38 Michiel Jan Laurens de Hoon wrote:
 For my application, I need to run gtk_main but I want to quit gtk_main 
 when either input is available on stdin or the user presses Ctrl-C. The 
 former is easy (using g_io_add_watch), but I am not sure what the best 
 approach is to handle Ctrl-C. Right now I am using g_timeout_add to 
 check every 100 milliseconds if Ctrl-C has been hit. But I'm wondering 
 if there is a better way to do this, preferably without checking 
 periodically for a Ctrl-C.
 
 The relevant code looks as follows:
 
 
 static gboolean
 _main_quit(GIOChannel* source, GIOCondition condition, gpointer data)
 {
  gtk_main_quit();
  return FALSE;
 }
 
 
 static int _interrupt_occurred = 0;
 
 
 static gboolean _check_interrupt(gpointer data)
 {
  if (_interrupt_occurred)
  {
  gtk_main_quit();
  return FALSE;
  }
  return TRUE;
 }
 
 
 static void _interrupt_handler(int sig)
 {
  _interrupt_occurred = 1;
 }
 
 
 int main(void)
 {
  /* ... some other code up here ... */
  signal(SIGINT, _interrupt_handler);
  GIOChannel* channel = g_io_channel_unix_new(fileno(stdin));
  g_io_add_watch(channel, G_IO_IN, _main_quit, NULL);
  g_io_channel_unref(channel);
  g_timeout_add(100, _check_interrupt, NULL);
  gtk_main();
  if (_interrupt_occurred)
  {
  _interrupt_occurred = 0;
  /* Do something with the interrupt */
  }
  return 0;
 }
 
 
 
 Many thanks in advance,
 
 --Michiel.
 
 

Hi,

maybe adding this to main

/*signal(SIGHUP,SIG_IGN); *//* ignore SIGHUP */
/*signal(SIGTERM,signal_handler);*/ /* catch SIGTERM */
signal(SIGINT,signal_handler);  /* catch SIGINT  */


and using this handler

static void signal_handler(int sig) __attribute__(( __noreturn__ ));
static void signal_handler(int sig)
{
switch (sig) {
case SIGINT:
puts(SIGINT signal catched);
break;
case SIGTERM:
puts(SIGTERM signal catched);
break;
}
/* Do something useful here */
exit(EXIT_FAILURE);
}

Ciao,
Tito

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


Re: Glade-2 and deprecated gdk_pixbuf_unref() call / Glade-3

2006-12-27 Thread zz
On Wednesday 27 December 2006 20:23, Daniel Yek wrote:
 Hi,
 
 Glade-3 was released as stable a few months ago, right?
 
 I saw http://glade.gnome.org stated that Glade-3 requires GTK+ 2.8. Does it 
 mean that the resulting application requires GTK+2.8 too? Or was it a 
 requirement for the development machine only?
 
 My application baseline is GTK+ 2.4; does that mean that I can't use 
 Glade-3 in my project yet?
 
 
 
 I'm trying to get rid of the deprecated gdk_pixbuf_unref() calls in the 
 *_interface.c files from Glade-2.
 
 Is there a recommended way to do that? Is Glade-2 going to be fixed to not 
 produce deprecated function calls?
 
 This particular fix is really easy -- just replacing gdk_pixbuf_unref() 
 with g_object_unref().
 If there is no interest in fixing Glade-2, is there a work-around I can use 
 without manually changing / post-processing the generated files?

Maybe:

#define gdk_pixbuf_unref g_object_unref

Ciao,
Tito 

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


Re: help on scrollbars

2006-08-30 Thread zz

-Messaggio Originale- 
From: Paul Pogonyshev
Sent: 29/8/2006 8:25:05 PM
To: gtk-app-devel-list@gnome.org
Cc: [EMAIL PROTECTED]
Subject: Re: help on scrollbars

[EMAIL PROTECTED] wrote:
 Hi,
 I'm working on an app and I'm facing the need to access the
 button at the end of a vertical scrollbar of a scrolled window
 to do something like a
 
 gtk_button_clicked()
 
 to ensure that the widget (a treeview) contained in it
 gets scrolled to the end with whatever screen resolution
 is used.

Untested. This might help:

gtk_adjustment_set_value (gtk_scrolled_window_get_adjustment
(scrolled_window),
 DBL_MAX);

where `scrolled_window' contains the tree, of course. Actually
`DBL_MAX' can be replaced with any large enough value, like
1e100, if you don't want to include `float.h'.

Paul
.


I've tried this already but it doesn't work as expected.
What I get is:
1) I add a row to the treeview and call the function you suggested or
similar
2) the slider of the scrollbar correctly slides to the end
3) the rebounds to the middle of his range

I'm thinking about posting some example code
so that this is reproducible for others..

TIA and Ciao,
Tito 


Ppfont face=Arial, Helvetica, sans-serif size=2 
style=font-size:13.5px___BRBODY
BR
Milioni di oggetti, impossibile non trovare quello che cerchi.BR
Dallo spillo all'elefante, non ti stupire.BR
Sei su a 
href=http://adfarm.mediaplex.com/ad/ck/724-25726-1029-36?id=1;eBay!/a


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


Re: help on scrollbars

2006-08-30 Thread zz

-Messaggio Originale- 
From: David Neèas \(Yeti\)
Sent: 29/8/2006 6:38:20 PM
To: gtk-app-devel-list@gnome.org
Subject: Re: help on scrollbars

On Tue, Aug 29, 2006 at 02:11:09PM +0200, [EMAIL PROTECTED] wrote:
 I'm working on an app and I'm facing the need to access the
 button at the end of a vertical scrollbar of a scrolled window
 to do something like a
 
 gtk_button_clicked()
 
 to ensure that the widget (a treeview) contained in it
 gets scrolled to the end with whatever screen resolution
 is used.
 
 This obviously in the assumption that this little buttons
 are real gtk_buttons
 
 I read most of the source and reference but haven't found
 nothing usefull and I also have tried some alternatives like:
 
 void list_vertical_autoscroll(GtkWidget *list)
 {
 GtkAdjustment *adjustment;
 
 adjustment = gtk_tree_view_get_vadjustment(GTK_TREE_VIEW(list));
 gtk_adjustment_set_value(adjustment, adjustment-upper +=
ARBITRARY_BIG_NUMBER);
 /*or*/
 gtk_adjustment_set_value(adjustment, adjustment-upper
+adjustment-page_size); 
 }
 
 that achieve some scrolling but not to the very end of the treeview.
 
 The only thing that works the way i would like it is to click with
mouse
 on the v button that's why I'm looking for a way to fake this click
 with a function.
 
 Could someone make me see the light?

As far as I understand you just need to copy the couple of
lines from step_forward() (or step_back()) in gtkrange.c,
replacing g_signal_emit() with g_signal_emit_by_name().

Yeti


Hi,
Tried this but sadly I was not able to make it work for me.
Probably clicking on the buttons just move up or down
one step and not to the very end of the treeview.

I'm thinking to post some example code to the list
so that my problem could be reproducible for 
others

TIA and ciao,
Tito 


Ppfont face=Arial, Helvetica, sans-serif size=2 
style=font-size:13.5px___BRBODY
BR
Milioni di oggetti, impossibile non trovare quello che cerchi.BR
Dallo spillo all'elefante, non ti stupire.BR
Sei su a 
href=http://adfarm.mediaplex.com/ad/ck/724-25726-1029-36?id=1;eBay!/a


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


help on scrollbars

2006-08-29 Thread zz
Hi,
I'm working on an app and I'm facing the need to access the
button at the end of a vertical scrollbar of a scrolled window
to do something like a

gtk_button_clicked()

to ensure that the widget (a treeview) contained in it
gets scrolled to the end with whatever screen resolution
is used.

This obviously in the assumption that this little buttons
are real gtk_buttons

I read most of the source and reference but haven't found
nothing usefull and I also have tried some alternatives like:

void list_vertical_autoscroll(GtkWidget *list)
{
GtkAdjustment *adjustment;

adjustment = gtk_tree_view_get_vadjustment(GTK_TREE_VIEW(list));
gtk_adjustment_set_value(adjustment, adjustment-upper += 
ARBITRARY_BIG_NUMBER);
/*or*/
gtk_adjustment_set_value(adjustment, adjustment-upper 
+adjustment-page_size); 
}

that achieve some scrolling but not to the very end of the treeview.

The only thing that works the way i would like it is to click with mouse
on the v button that's why I'm looking for a way to fake this click
with a function.

Could someone make me see the light?
Am i totally wrong?

TIA and Ciao,
Tito 
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Help about GtkTreeViewColumn

2006-07-24 Thread zz
Hi,
I'm developing an app that uses a mysql database so I'm doing a lot of work 
with tree views.
Now I'm wondering if it is possible to align the text in the cells of the  
single columns of the tree view
in the same way you can do it with the headers.

gtk_tree_view_column_set_alignment((GtkTreeViewColumn 
*)gtk_tree_view_get_column ((GtkTreeView *)tot_list, 0), 0.0);

I've RTFM but have not found a way to do this so far  :(
Hints are wellcome.

Thanks in advance.

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


Re: callback and menu item

2006-03-31 Thread zz
On Thursday 30 March 2006 14:49, Jerome Le Saux wrote:
 2006/3/30, [EMAIL PROTECTED] [EMAIL PROTECTED]:
 
  On Thursday 30 March 2006 12:15, Jerome Le Saux wrote:
  If you want to do this at program startup you have to call
  OnOpenDskFile by yourself in main()
 
  Ciao,
  Tito
 
 
 
 Thanks for your answer.
 I want to use this function only when the item of the menu is selected.
 
 Sincerely
 
 Jerome

BTW: it is better to send code as attachment as the mail clients mess it up. 
  also  adding GestDsk.h wouldn't be bad so it would be possible to
  actually try to compile the code and give more helpful hints.

Ciao,
Tito
 
   I want to fill the DirList Widget in the OnOpenDskFile function and to
  be
   displayed in the scrolled_window.
   What's wrong ?
  
   Sincerely
  
   Jerome
   ___
   gtk-app-devel-list mailing list
   gtk-app-devel-list@gnome.org
   http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
  
  
  ___
  gtk-app-devel-list mailing list
  gtk-app-devel-list@gnome.org
  http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
 
 ___
 gtk-app-devel-list mailing list
 gtk-app-devel-list@gnome.org
 http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
 
 
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: callback and menu item

2006-03-30 Thread zz
On Thursday 30 March 2006 12:15, Jerome Le Saux wrote:
If you want to do this at program startup you have to call
 OnOpenDskFile by yourself in main()

Ciao,
Tito
 
 I want to fill the DirList Widget in the OnOpenDskFile function and to be
 displayed in the scrolled_window.
 What's wrong ?
 
 Sincerely
 
 Jerome
 ___
 gtk-app-devel-list mailing list
 gtk-app-devel-list@gnome.org
 http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
 
 
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Question about gtk_file_selection_new

2006-03-19 Thread zz
Hi,
is there a way to make file selection dialog box created with  
gtk_file_selection_new
also display hidden files??

I RTFM and studied the source but was not able to figure it out.

Thanks in advance for your time.

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


Re: Question about gtk_file_selection_new

2006-03-19 Thread zz
On Sunday 19 March 2006 14:27, you wrote:
Am Sonntag, den 19.03.2006, 11:44 +0100 schrieb [EMAIL PROTECTED]:
 
 is there a way to make file selection dialog box created with
 gtk_file_selection_new
 also display hidden files??

gtk_file_chooser_set_show_hidden. I wonder why you need this, though.

i've tested this so far but this seems to work only with widgets created with

GtkWidget*  gtk_file_chooser_widget_new (GtkFileChooserAction action);

and not with 

GtkWidget*  gtk_file_selection_new  (const gchar *title);

which is the the one i would like to use for backwards compatibility 
with older code.

(gtk_file_manager:9650): Gtk-CRITICAL **: gtk_file_chooser_set_show_hidden: 
assertion `GTK_IS_FILE_CHOOSER (chooser)' failed
gtk_file_manager: file_selector()

Ciao,
Tito
-- 
Christian Neumair [EMAIL PROTECTED]
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list