Re: is this correct way to open file in buffer?

2013-01-30 Thread Gregory Hosler
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 01/30/2013 07:39 AM, Rudra Banerjee wrote:
 Dear friends, I am trying hard to get rid of file reading and editing (as
 evident from my previous post) Here is a small code where I tried to open
 my file in a buffer and scan. Its small, 50 line code. I will be grateful
 if anybody kindly have a look and tell if this is really opening the file
 from buffer or still using the file. Please help.

I am coming late into this thread, so please forgive the following question(s).

I would like clarification opening the file from buffer or still using the 
file.

In C, there is an api that allows us to open a file, and then associate a
memory location with the file's contents. There after, any modification to the
file, automatically shows in the buffer (i.e. no read() or re-read is
required) and any modification to the file buffer will automatically show on
disk (without the necessity of a write()).

Is this what you are trying to do ?

If yes, then the below will not accomplish this. The C api is to do a standard
open(2) and then a mmap(2) to associate the file's buffer to a fixed memory
location - I am happy to supply more details upon a confirmation.

All the best,

- -Greg

 void open_file(GtkWidget *widget, gpointer data){ GScanner *scanner; 
 GHashTable *table; char* fd; gsize length; GError* error=NULL; GtkWidget
 *dialog; //, *entry; GtkFileFilter *filter; dialog =
 gtk_file_chooser_dialog_new(Open File, NULL, 
 GTK_FILE_CHOOSER_ACTION_OPEN, GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, 
 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, NULL);
 
 filter = gtk_file_filter_new(); gtk_file_filter_set_name(filter, All files
 (*.*)); gtk_file_filter_add_pattern(filter, *); 
 gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog), filter);
 
 filter = gtk_file_filter_new(); gtk_file_filter_set_name(filter, Bibtex
 file (*.bib)); gtk_file_filter_add_pattern(filter, *.bib); 
 gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog), filter); 
 gtk_file_chooser_set_filter(GTK_FILE_CHOOSER(dialog), filter);
 
 if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) { filename =
 gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); 
 gtk_list_store_clear (store); g_file_get_contents(filename, fd, length ,
 error); g_assert(!error);
 
 scanner = g_scanner_new (NULL); g_scanner_input_text (scanner, fd,
 CHAR_BUFF);
 
 table = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); 
 do { g_hash_table_remove_all (table); parse_entry (scanner, table); 
 output_entry (table);
 
 g_scanner_peek_next_token (scanner); } while (scanner-next_token !=
 G_TOKEN_EOF  scanner-next_token != G_TOKEN_ERROR);
 
 
 /* finsish parsing */ g_scanner_destroy (scanner); g_hash_table_destroy
 (table);
 
 gtk_label_set_text(GTK_LABEL(flabel), filename); 
 gtk_widget_destroy(dialog); } else gtk_widget_destroy(dialog); }
 
 ___ gtk-app-devel-list mailing
 list gtk-app-devel-list@gnome.org 
 https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
 


- -- 
+-+

Please also check the log file at /dev/null for additional information.
(from /var/log/Xorg.setup.log)

| Greg Hosler   ghos...@redhat.com|
+-+
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.13 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEARECAAYFAlEIYewACgkQ404fl/0CV/TEZwCgrUZ9iXok5ykJLMAg0dn8QfAU
EDsAn2oAgw6aoXMG39yWQSu1RW7o8Gux
=b+22
-END PGP SIGNATURE-
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: is this correct way to open file in buffer?

2013-01-30 Thread Rudra Banerjee
Well, 
my final goal is to able to edit the file, but not save every time
something  has changed. 
So, in irc and other place, i was instructed to use get_contents method.
Can you kindly clarify where I went wrong?
On Wed, 2013-01-30 at 07:57 +0800, Gregory Hosler wrote:
 On 01/30/2013 07:39 AM, Rudra Banerjee wrote:
  Dear friends, I am trying hard to get rid of file reading and editing (as
  evident from my previous post) Here is a small code where I tried to open
  my file in a buffer and scan. Its small, 50 line code. I will be grateful
  if anybody kindly have a look and tell if this is really opening the file
  from buffer or still using the file. Please help.
 
 I am coming late into this thread, so please forgive the following 
 question(s).
 
 I would like clarification opening the file from buffer or still using the 
 file.
 
 In C, there is an api that allows us to open a file, and then associate a
 memory location with the file's contents. There after, any modification to the
 file, automatically shows in the buffer (i.e. no read() or re-read is
 required) and any modification to the file buffer will automatically show on
 disk (without the necessity of a write()).
 
 Is this what you are trying to do ?
 
 If yes, then the below will not accomplish this. The C api is to do a standard
 open(2) and then a mmap(2) to associate the file's buffer to a fixed memory
 location - I am happy to supply more details upon a confirmation.
 
 All the best,
 
 -Greg
 
  void open_file(GtkWidget *widget, gpointer data){ GScanner *scanner; 
  GHashTable *table; char* fd; gsize length; GError* error=NULL; GtkWidget
  *dialog; //, *entry; GtkFileFilter *filter; dialog =
  gtk_file_chooser_dialog_new(Open File, NULL, 
  GTK_FILE_CHOOSER_ACTION_OPEN, GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, 
  GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, NULL);
  
  filter = gtk_file_filter_new(); gtk_file_filter_set_name(filter, All files
  (*.*)); gtk_file_filter_add_pattern(filter, *); 
  gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog), filter);
  
  filter = gtk_file_filter_new(); gtk_file_filter_set_name(filter, Bibtex
  file (*.bib)); gtk_file_filter_add_pattern(filter, *.bib); 
  gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog), filter); 
  gtk_file_chooser_set_filter(GTK_FILE_CHOOSER(dialog), filter);
  
  if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) { filename =
  gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); 
  gtk_list_store_clear (store); g_file_get_contents(filename, fd, length ,
  error); g_assert(!error);
  
  scanner = g_scanner_new (NULL); g_scanner_input_text (scanner, fd,
  CHAR_BUFF);
  
  table = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); 
  do { g_hash_table_remove_all (table); parse_entry (scanner, table); 
  output_entry (table);
  
  g_scanner_peek_next_token (scanner); } while (scanner-next_token !=
  G_TOKEN_EOF  scanner-next_token != G_TOKEN_ERROR);
  
  
  /* finsish parsing */ g_scanner_destroy (scanner); g_hash_table_destroy
  (table);
  
  gtk_label_set_text(GTK_LABEL(flabel), filename); 
  gtk_widget_destroy(dialog); } else gtk_widget_destroy(dialog); }
  
  ___ 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: 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: is this correct way to open file in buffer?

2013-01-30 Thread Tristan Van Berkom
On Wed, Jan 30, 2013 at 8:39 AM, Rudra Banerjee
rudra.baner...@aol.co.uk wrote:
 Dear friends,
 I am trying hard to get rid of file reading and editing (as evident from
 my previous post)
 Here is a small code where I tried to open my file in a buffer and scan.
 Its small, 50 line code.
 I will be grateful if anybody kindly have a look and tell if this is
 really opening the file from buffer or still using the file. Please
 help.

I can't tell you what it is 'still' doing, however in the code portions
which you've posted here, you are first reading the contents of the
file into a buffer using g_file_get_contents(); and then parsing
that buffer afterwards.

I assume this is what you're after, however I should point out
that naming your allocated buffer 'fd' is thoroughly confusing
to the reader.

At first glance, it would appear that your scanner is operating
on an fd, i.e. a file descriptor, not an allocated buffer.

Cheers,
-Tristan



 void open_file(GtkWidget *widget, gpointer data){
   GScanner *scanner;
   GHashTable *table;
   char* fd;
   gsize length;
   GError* error=NULL;
 GtkWidget *dialog; //, *entry;
 GtkFileFilter *filter;
 dialog = gtk_file_chooser_dialog_new(Open File, NULL,
 GTK_FILE_CHOOSER_ACTION_OPEN,
 GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
 NULL);

 filter = gtk_file_filter_new();
 gtk_file_filter_set_name(filter, All files (*.*));
 gtk_file_filter_add_pattern(filter, *);
 gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog), filter);

 filter = gtk_file_filter_new();
 gtk_file_filter_set_name(filter, Bibtex file (*.bib));
 gtk_file_filter_add_pattern(filter, *.bib);
 gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog), filter);
 gtk_file_chooser_set_filter(GTK_FILE_CHOOSER(dialog), filter);

 if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) {
 filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
 gtk_list_store_clear (store);
 g_file_get_contents(filename, fd, length , error);
 g_assert(!error);

  scanner = g_scanner_new (NULL);
  g_scanner_input_text (scanner, fd, CHAR_BUFF);

  table = g_hash_table_new_full (g_str_hash, g_str_equal, g_free,
 g_free);
  do
{
  g_hash_table_remove_all (table);
parse_entry (scanner, table);
output_entry (table);

  g_scanner_peek_next_token (scanner);
}
  while (scanner-next_token != G_TOKEN_EOF 
 scanner-next_token != G_TOKEN_ERROR);


   /* finsish parsing */
  g_scanner_destroy (scanner);
  g_hash_table_destroy (table);

 gtk_label_set_text(GTK_LABEL(flabel), filename);
 gtk_widget_destroy(dialog);
 }
 else
 gtk_widget_destroy(dialog);
 }

 ___
 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


Threads and gtk_widget_show (code should not be reached?)

2013-01-30 Thread Ferdinand Ramirez
I have encountered a strange error followed by a crash when I add the following 
object to a GtkTextView by creating a child anchor and call gtk_widget_show_all.

The object that is added

The object that is added to the child anchor is a GtkFrame inside which is a 
GtkTable and each cell of the table contains another GtkFrame each of which 
contains a GtkTextView.

The error

This works fine if it is all done from the main program. However, when I create 
the hierarchy described above in another thread and call gtk_widget_show_all on 
the GtkFrame that is added, I get an error in paint saying code should not be 
reached. Before this error, there is a warning that the iterator in text view 
has changed. I am not sure if the warning and error are related.

Source of the error

I replaced gtk_widget_show_all by gtk_widget_show in a loop going down the tree 
and calling it for each object. The source of the error was the gtk_widget_show 
on the leaf level view objects in the frames contained in each cell of the 
table.

Situations under which it works

When the leaf level GtkTextView objects are not part of the hierarchy of 
widgets I create or they are replaced by GtkEntry objects, everything works 
fine. Again, note that it also works fine if I do not have another thread and 
call everything from the main program on startup but I need to have another 
thread as this object will be created during the course of the program. I've 
tried both g_idle_add as well as using the gdk_threads_enter/leave pair.

Any help will be appreciated.

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


Re: Threads and gtk_widget_show (code should not be reached?)

2013-01-30 Thread Edscott Wilson
The current method for calling gtk_xx instructions is from the main thread
only (i.e., that which owns the main loop context). You can do this by
means of g_main_context_invoke(). Otherwise you must use the deprecated
gdk_threads_enter/gdk_threads_leave mutex method. The deprecated method is
slower.

If you do not do the above, you will get all sort of errors just like the
one you describe.

HTH

2013/1/30 Ferdinand Ramirez ramirez.ferdin...@yahoo.com

 I have encountered a strange error followed by a crash when I add the
 following object to a GtkTextView by creating a child anchor and call
 gtk_widget_show_all.

 The object that is added

 The object that is added to the child anchor is a GtkFrame inside which is
 a GtkTable and each cell of the table contains another GtkFrame each of
 which contains a GtkTextView.

 The error

 This works fine if it is all done from the main program. However, when I
 create the hierarchy described above in another thread and call
 gtk_widget_show_all on the GtkFrame that is added, I get an error in paint
 saying code should not be reached. Before this error, there is a warning
 that the iterator in text view has changed. I am not sure if the warning
 and error are related.

 Source of the error

 I replaced gtk_widget_show_all by gtk_widget_show in a loop going down the
 tree and calling it for each object. The source of the error was the
 gtk_widget_show on the leaf level view objects in the frames contained in
 each cell of the table.

 Situations under which it works

 When the leaf level GtkTextView objects are not part of the hierarchy of
 widgets I create or they are replaced by GtkEntry objects, everything works
 fine. Again, note that it also works fine if I do not have another thread
 and call everything from the main program on startup but I need to have
 another thread as this object will be created during the course of the
 program. I've tried both g_idle_add as well as using the
 gdk_threads_enter/leave pair.

 Any help will be appreciated.

 -Ferdinand
 ___
 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


writing to a buffer: help

2013-01-30 Thread Rudra Banerjee
Dear friends, 
Please have a look at http://fpaste.org/gvF3/
So, I am writing those values to a string and then to a file(for now!)
given that, Entries e are a structure, as, 
typedef struct {
GtkWidget *combo, *entry1, *entryAuth, *entryEditor, *entryTitle,
*entryPub, *entryVol, *entryIss, *entryPage, *entryMon,
*entryNote, *entryKey, *entryYear, *entryAdd, *entryEdition,
*entryJournal, *entrySeries, *entryBooktitle, *entryOrg,
*entryChap, *entrySchool;
} Entries;

is there a better way of writing this; considering the fact that I have
to check if any of the entry is NULL?

My second question in this is that,
I have created a buffer from a file in a different function as

  char* buffer;
  gsize length;
  GError* error=NULL; 
  filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
  g_file_get_contents(filename, buffer, length , error);

I have not g_free-d it. Can I use the same buffer to if I want to
append the buffer from update_file.c? Or should I g_free that buffer and
reopen it?

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


Re: Threads and gtk_widget_show (code should not be reached?)

2013-01-30 Thread Edscott Wilson
BTW, g_main_context_invoke() will be erratic if you do not have the main
context loop running. This is common at startup, when you do all sort of
gtk_xx before entering the main loop. Solution: start the loop as soon as
possible in the main thread, and anything else the main thread needs to do,
put in a g_idle function.

2013/1/30 Edscott Wilson edscott.wilson.gar...@gmail.com

 The current method for calling gtk_xx instructions is from the main thread
 only (i.e., that which owns the main loop context). You can do this by
 means of g_main_context_invoke(). Otherwise you must use the deprecated
 gdk_threads_enter/gdk_threads_leave mutex method. The deprecated method is
 slower.

 If you do not do the above, you will get all sort of errors just like the
 one you describe.

 HTH


 2013/1/30 Ferdinand Ramirez ramirez.ferdin...@yahoo.com

 I have encountered a strange error followed by a crash when I add the
 following object to a GtkTextView by creating a child anchor and call
 gtk_widget_show_all.

 The object that is added

 The object that is added to the child anchor is a GtkFrame inside which
 is a GtkTable and each cell of the table contains another GtkFrame each of
 which contains a GtkTextView.

 The error

 This works fine if it is all done from the main program. However, when I
 create the hierarchy described above in another thread and call
 gtk_widget_show_all on the GtkFrame that is added, I get an error in paint
 saying code should not be reached. Before this error, there is a warning
 that the iterator in text view has changed. I am not sure if the warning
 and error are related.

 Source of the error

 I replaced gtk_widget_show_all by gtk_widget_show in a loop going down
 the tree and calling it for each object. The source of the error was the
 gtk_widget_show on the leaf level view objects in the frames contained in
 each cell of the table.

 Situations under which it works

 When the leaf level GtkTextView objects are not part of the hierarchy of
 widgets I create or they are replaced by GtkEntry objects, everything works
 fine. Again, note that it also works fine if I do not have another thread
 and call everything from the main program on startup but I need to have
 another thread as this object will be created during the course of the
 program. I've tried both g_idle_add as well as using the
 gdk_threads_enter/leave pair.

 Any help will be appreciated.

 -Ferdinand
 ___
 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


cannot edit the text entry box when open the window at first time

2013-01-30 Thread Hz
http://www.pygtk.org/pygtk2tutorial/sec-TextEntries.html#entryfig

This link is the pygtk's official example. While running on my WIN7 system,
the text entry box cannot be edited since the first time opening. But if
you move mouse to activate other window, and turn back to this gtk window,
the text entry box can be edited then. I am not sure if this is a pygtk's
bug.

I also meet this kind of issue in my own application and have posted a
question on stackoverflow.com but no one response, so I came to here
looking for help. Here is stackoverflow link:
http://stackoverflow.com/questions/14038104/cannot-access-text-entry-box-after-reopen-the-gtk-window


I have tried python 2.6.6 and 2.7.3 with pygtk2.24.2-all-in-one.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


How to implement a submenu for a GtkAction

2013-01-30 Thread Ma Xiaojun
I'm trying to add a feature to File Roller like this:
http://dl.dropbox.com/u/45139465/The%20Archive%20Browser.png

However, I can only add a single entry to File Roller's File (Archive)
menu. I cannot have a sub menu.
I tried adding a menuitem in ui XML, but I cannot have sub menu on it.
I also referenced Gedit's code of HighlightModeMenu, it uses a menu
and inside a placeholder in it as ui XML. I tried the same thing but
now even the single entry is invisible. I haven't understand and mimic
how Gedit dynamically add submenu entries though.

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


custom widget with gtk

2013-01-30 Thread Doudieu Siewe Narcisse
Hello every world,

I have one suggestion for gnome:

Actually there is a tuto on how to make derived class from gobject but in
the case of gtk nothing is very clear no ideas of which gtk widget to
instantitate, which methods to rewrite etc...another important thing is to
tell to developper about which the parent class and instantiated class and
how to finalize both parent and instantiated class.

Actually I have some problème with gtkbin, gtk doesn't say if this widget
is a windowless widget and when I derived this gtk widget and after packing
into a topleve
l widget, gtkbin can draw its childs on the parent frame but which own a
window. So some people can tell m what is wrong or what I need to implement?
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Gonmedate format issue

2013-01-30 Thread Ashok Chauhan
Hi All,

I’m using below code to set the date in gnome date dialog box but getting 
different results in Centos 6 and Ubuntu 11 operating systems.
  
 
 In Ubuntu, it is showing dates in weekday, day, month-name and year (Saturday 
 01 December 2012) instead of DD/MM/YY (01/12/12).
 
  
 
 Please help me because I need to port my application to Ubuntu ASAP and due 
 to this hurdle not able to proceed further.
 
  
 
 void abc_set_date_to_GnomeDateEdit(GnomeDateEdit *gde,char* date)
 {
 struct timeb tp1;struct tm * tsp1; struct tm mystructure;
 int day,month,year;
 char c_day[10],c_month[10],c_year[10];
 
 tsp1 = mystructure;
 strncpy(c_day,date,2);c_day[2]='\0';
 strncpy(c_month,date+3,2);c_month[2]='\0';
 strncpy(c_year,date+6,4);c_year[4]='\0';
 day=atoi(c_day); 
 month=atoi(c_month)-1;
 year=atoi(c_year)-1900;
 tsp1-tm_isdst=0;
 tsp1-tm_min=0;
 tsp1-tm_hour=0;
 tsp1-tm_sec=0;
 tsp1-tm_year = year;
 tsp1-tm_mon= month;
 tsp1-tm_mday = day ;
 tp1.time=mktime(tsp1);
 gnome_date_edit_set_time(gde, tp1.time); 
 }
 
 
 OUTPUT IN UBUNTU (Incorrect output)
 
  
 
 
 
  
 
 OUTPUT IN CENTOS 6(Correct output)
 
  
 
 
 
  
 
 Regards,
 
 Ashok
 
  
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

GTK app development for windows.

2013-01-30 Thread Muhammed Fatih BALIN

Hello!

I am a student and learned a little about gtk and writing programs using it.
On Ubuntu 12.04 I can create, compile and run applications easily but I 
want to compile them for windows.
I have mingw packages installed. But there is no gtk package in ubuntu 
repositories for cross development. How can I install necessary packages 
on ubuntu and compile gtk applications for windows on _ubuntu_?

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


color box, hang tag and label

2013-01-30 Thread Jinghao Printing - CHINA
Hi, this is David Wu from Shanghai, China.
We are a printing company, we can print color box, corrugated box, label,
hang tag etc.
Please let me know if you need these.

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


Gnome 3 style tabs

2013-01-30 Thread Satyajit Sahoo
Hi, I'm trying to implement a GUI in vala with tabs like in new Gnome 3
apps. I'm mostly successful, but have a few hiccups. I think perhas this
may not be the nicest implementation.

And, when you click a active tab, then the togglebutton state changes,
which is kinda confusing. I cannot think of a way to workaround it.

I'm very much new to vala, so please be kind to me :D

The code of the app is here
https://github.com/satya164/elegance-colors/blob/master/elegance-colors-gui.vala
-- 
Satyajit Sahoo
Profile - Facebook http://facebook.com/satya164,
Google+http://plus.google.com/u/0/114564489020097923600
Artwork - DeviantArt http://satya164.deviantart.com
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: writing to a buffer: help

2013-01-30 Thread Damien Caliste
Hello,

Le 30/01/2013, Rudra Banerjee rudra.baner...@aol.co.uk a écrit :
 My second question in this is that,
 I have created a buffer from a file in a different function as
 
   char* buffer;
   gsize length;
   GError* error=NULL; 
   filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
   g_file_get_contents(filename, buffer, length , error);
 
 I have not g_free-d it. Can I use the same buffer to if I want to
 append the buffer from update_file.c? Or should I g_free that buffer
 and reopen it?
I think you miss the point here. Let's detail it further. Calling
g_file_get_contents(filename, buffer, length , error);

is equivalent in essence to:
File *f;
char *buffer;

f = fopen(filename, r);
buffer = malloc(sizeof(char) * (file length));
do
{
  buffer[i] = fgetc(f);
} while (!EOF);
fclose(f);

Which means that you open the file, copy the content to memory and
close the file. So what you call buffer is not related to your file
anymore, it is just an array of char in memory that contains whatever
your file was when it was read.

You can make changes to the content of this array (take care to the
size), they will not be mirrored in the file. This buffer is just a
memory array.

Then, you can create a new file (with the same name to overwrite) which
will contains the content of your memory array using
g_file_set_content(). But here again, the two stuffs are not connected.
Your file is opened, write the content of the memory array and close
afterwards. Whatever change you do to the array later will not reflect
in the file.

Is it clearer ?

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

Re: GTK app development for windows.

2013-01-30 Thread jcupitt
On 24 December 2012 13:16, Muhammed Fatih BALIN
catlak.profesor@gmail.com wrote:
 How can I install necessary packages on ubuntu and compile gtk applications 
 for windows on _ubuntu_?

You can download the win32 gtk binaries here:

http://www.gtk.org/download/win32.php

Just compile and link your program with gcc-mingw-w64.

If you have many other dependencies, jhbuild is very convenient. I
have a repro here which builds a setup.exe installer for a large
application, including a lot of deps.

https://github.com/jcupitt/build-win32/tree/master/7.30

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


Re: writing to a buffer: help

2013-01-30 Thread Rudra Banerjee
On Wed, 2013-01-30 at 16:32 +0100, Damien Caliste wrote:
 Is it clearer ?
Much clearer!
So, in a nutshell, as long as it is not free-ed, I can access it from
any other function using
char buffer
and buffer, right?

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


Re: GTK app development for windows.

2013-01-30 Thread Ardhan Madras
One thing you should know that most version of GTK+ in today Linux
system is using version 3.x.
The latest maintained version of GTK+ for Windows is 2.24, this is
pretty old (almost 2 years ago). I don't know when will the GTK+ 3
comes to Windows. Hoperfully someone would tell us what happen on GTK+
3 for Windows.

I recommended you to use also GTK+ 2 in Linux, and you can build it
with no or less efforts in Windows compared if you use GTK+ 3 in Linux
but build it with GTK+ 2 in Windows.

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


Re: GTK app development for windows.

2013-01-30 Thread John Stebbins
On 01/30/2013 09:32 AM, Ardhan Madras wrote:
 One thing you should know that most version of GTK+ in today Linux
 system is using version 3.x.
 The latest maintained version of GTK+ for Windows is 2.24, this is
 pretty old (almost 2 years ago). I don't know when will the GTK+ 3
 comes to Windows. Hoperfully someone would tell us what happen on GTK+
 3 for Windows.

 I recommended you to use also GTK+ 2 in Linux, and you can build it
 with no or less efforts in Windows compared if you use GTK+ 3 in Linux
 but build it with GTK+ 2 in Windows.

 Regards.


Not sure where you are getting your information.  I just built HandBrake using 
the mingw tools on Fedora 18 with gtk+ 3
support.  Works spiffy.

-- 
John  GnuPG fingerprint: D0EC B3DB C372 D1F1 0B01  83F0 49F1 D7B2 60D4 D0F7


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


Re: GTK app development for windows.

2013-01-30 Thread David Nečas
On Thu, Jan 31, 2013 at 12:32:48AM +0700, Ardhan Madras wrote:
 One thing you should know that most version of GTK+ in today Linux
 system is using version 3.x.

This is somewhat inaccurate.  All major Linux distributions contain
Gtk+3 packages and the number of Gtk+3 programs grows.  But if you look
outside core Gnome3, at third-party programs, the number of Gtk+2
programs is huge.  Some will be never ported.  After all, even though
they are quite rare nowadays, some Gtk+1 programs still have not been
ported to Gtk+2...

 I recommended you to use also GTK+ 2 in Linux, and you can build it
 with no or less efforts in Windows compared if you use GTK+ 3 in Linux
 but build it with GTK+ 2 in Windows.

For new projects, I would not recommend using Gtk+2 unless you are
quite conservative or it is a small project using only stock widgets
(in such case porting to Gtk+3 will not be a big deal).

For larger projects, it is more likely that Gtk+3 will be fine on MS
Windows and Gtk+2 obsolete everywhere when you get to releasing a stable
version...

Yeti

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


Re: GTK app development for windows.

2013-01-30 Thread Ardhan Madras
Yes we know that, they still providing GTK+2 or GTK+ for backward compability.
I was mean about version, because there are no stable GTK+ 3 for
Windows yet ( at least in official site gtk.org ), so if he want to
build his GTK+ app in Windows, the maintained and bundled development
release is available, that is version 2.24.
So, for less effort, Its better for him to use GTK+ 2 in Linux too,
unless he want to distiguish between GTK+3 and GTK+2 calls in the
code.

Regards.

2013/1/31 David Nečas y...@physics.muni.cz:
 On Thu, Jan 31, 2013 at 12:32:48AM +0700, Ardhan Madras wrote:
 One thing you should know that most version of GTK+ in today Linux
 system is using version 3.x.

 This is somewhat inaccurate.  All major Linux distributions contain
 Gtk+3 packages and the number of Gtk+3 programs grows.  But if you look
 outside core Gnome3, at third-party programs, the number of Gtk+2
 programs is huge.  Some will be never ported.  After all, even though
 they are quite rare nowadays, some Gtk+1 programs still have not been
 ported to Gtk+2...

 I recommended you to use also GTK+ 2 in Linux, and you can build it
 with no or less efforts in Windows compared if you use GTK+ 3 in Linux
 but build it with GTK+ 2 in Windows.

 For new projects, I would not recommend using Gtk+2 unless you are
 quite conservative or it is a small project using only stock widgets
 (in such case porting to Gtk+3 will not be a big deal).

 For larger projects, it is more likely that Gtk+3 will be fine on MS
 Windows and Gtk+2 obsolete everywhere when you get to releasing a stable
 version...

 Yeti

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

Re: GTK app development for windows.

2013-01-30 Thread Andrew Potter
On Wed, Jan 30, 2013 at 10:52 AM, John Stebbins stebb...@jetheaddev.comwrote:

 Not sure where you are getting your information.  I just built HandBrake
 using the mingw tools on Fedora 18 with gtk+ 3
 support.  Works spiffy.

Presumably he is getting his information from
http://www.gtk.org/download/win32.php

It is relatively easy to cross-compile a Gtk3 Windows .exe with mingw.

But how do you give users the program? They need the Gtk3
 dependency .DLLs to run it. There is no Gtk3 installer. Do you have your
own installer and distribute the .DLLs that are in the Fedora packages? I'm
curious to know if that works. Also if you could share some details on your
installer I would appreciate it.

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


Re: GTK app development for windows.

2013-01-30 Thread John Stebbins
On 01/30/2013 11:24 AM, Andrew Potter wrote:
 On Wed, Jan 30, 2013 at 10:52 AM, John Stebbins 
 stebb...@jetheaddev.comwrote:

 Not sure where you are getting your information.  I just built HandBrake
 using the mingw tools on Fedora 18 with gtk+ 3
 support.  Works spiffy.

 Presumably he is getting his information from
 http://www.gtk.org/download/win32.php

 It is relatively easy to cross-compile a Gtk3 Windows .exe with mingw.

 But how do you give users the program? They need the Gtk3
  dependency .DLLs to run it. There is no Gtk3 installer. Do you have your
 own installer and distribute the .DLLs that are in the Fedora packages? I'm
 curious to know if that works. Also if you could share some details on your
 installer I would appreciate it.

 Thanks
 ___


Ah, never bothered to look for an official user oriented gtk release. I 
figure it's unreasonable to expect users to
install all of gtk just so they can try out some random program that happens to 
use gtk.  So I just package the
necessary DLLs and other configuration information with the exe.

-- 
John  GnuPG fingerprint: D0EC B3DB C372 D1F1 0B01  83F0 49F1 D7B2 60D4 D0F7


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


Re: GTK app development for windows.

2013-01-30 Thread John Stebbins
On 01/30/2013 11:24 AM, Andrew Potter wrote:
 On Wed, Jan 30, 2013 at 10:52 AM, John Stebbins 
 stebb...@jetheaddev.comwrote:

 Not sure where you are getting your information.  I just built HandBrake
 using the mingw tools on Fedora 18 with gtk+ 3
 support.  Works spiffy.

 Presumably he is getting his information from
 http://www.gtk.org/download/win32.php

 It is relatively easy to cross-compile a Gtk3 Windows .exe with mingw.

 But how do you give users the program? They need the Gtk3
  dependency .DLLs to run it. There is no Gtk3 installer. Do you have your
 own installer and distribute the .DLLs that are in the Fedora packages? I'm
 curious to know if that works. Also if you could share some details on your
 installer I would appreciate it.

 Thanks
 ___


I realized I didn't answer your question completely.  My installer is just a 
zip file containing the directory tree of
everything needed.  I have a simple script that copies everything needed into 
the directory, then I zip it up.  Example
script attached.

-- 
John  GnuPG fingerprint: D0EC B3DB C372 D1F1 0B01  83F0 49F1 D7B2 60D4 D0F7

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


Re: GTK app development for windows.

2013-01-30 Thread John Stebbins

On 01/30/2013 01:08 PM, John Stebbins wrote:
 On 01/30/2013 11:24 AM, Andrew Potter wrote:
 On Wed, Jan 30, 2013 at 10:52 AM, John Stebbins 
 stebb...@jetheaddev.comwrote:

 Not sure where you are getting your information.  I just built HandBrake
 using the mingw tools on Fedora 18 with gtk+ 3
 support.  Works spiffy.

 Presumably he is getting his information from
 http://www.gtk.org/download/win32.php

 It is relatively easy to cross-compile a Gtk3 Windows .exe with mingw.

 But how do you give users the program? They need the Gtk3
  dependency .DLLs to run it. There is no Gtk3 installer. Do you have your
 own installer and distribute the .DLLs that are in the Fedora packages? I'm
 curious to know if that works. Also if you could share some details on your
 installer I would appreciate it.

 Thanks
 ___

 I realized I didn't answer your question completely.  My installer is just 
 a zip file containing the directory tree of
 everything needed.  I have a simple script that copies everything needed into 
 the directory, then I zip it up.  Example
 script attached.


Renaming script to prevent stripping by ML.

-- 
John  GnuPG fingerprint: D0EC B3DB C372 D1F1 0B01  83F0 49F1 D7B2 60D4 D0F7

#!/bin/bash
build=.
destdir=ghb.mingw64

mkdir -p ${destdir}/lib/
mkdir -p ${destdir}/bin/

# Copy EXEs
cp ${build}/gtk/src/.libs/ghb.exe ${destdir}/bin
cp ${build}/HandBrakeCLI.exe ${destdir}/bin

# Copy config info
cp -rL /usr/x86_64-w64-mingw32/sys-root/mingw/etc/ ${destdir}/
mkdir -p ${destdir}/share/glib-2.0/schemas
cp -r /usr/i686-w64-mingw32/sys-root/mingw/share/glib-2.0/schemas/* 
${destdir}/share/glib-2.0/schemas

# Copy DLLs
cp /usr/x86_64-w64-mingw32/sys-root/mingw/bin/libstdc++-6.dll ${destdir}/bin
cp /usr/x86_64-w64-mingw32/sys-root/mingw/bin/libatk-1.0-0.dll ${destdir}/bin
cp /usr/x86_64-w64-mingw32/sys-root/mingw/bin/libcairo-2.dll ${destdir}/bin
cp /usr/x86_64-w64-mingw32/sys-root/mingw/bin/libgcc_s_sjlj-1.dll ${destdir}/bin
cp /usr/x86_64-w64-mingw32/sys-root/mingw/bin/libgdk_pixbuf-2.0-0.dll 
${destdir}/bin
cp /usr/x86_64-w64-mingw32/sys-root/mingw/bin/libgio-2.0-0.dll ${destdir}/bin
cp /usr/x86_64-w64-mingw32/sys-root/mingw/bin/libglib-2.0-0.dll ${destdir}/bin
cp /usr/x86_64-w64-mingw32/sys-root/mingw/bin/libgmodule-2.0-0.dll 
${destdir}/bin
cp /usr/x86_64-w64-mingw32/sys-root/mingw/bin/libgobject-2.0-0.dll 
${destdir}/bin
cp /usr/x86_64-w64-mingw32/sys-root/mingw/bin/iconv.dll ${destdir}/bin
cp /usr/x86_64-w64-mingw32/sys-root/mingw/bin/libintl-8.dll ${destdir}/bin
cp /usr/x86_64-w64-mingw32/sys-root/mingw/bin/libpango-1.0-0.dll ${destdir}/bin
cp /usr/x86_64-w64-mingw32/sys-root/mingw/bin/libpangocairo-1.0-0.dll 
${destdir}/bin
cp /usr/x86_64-w64-mingw32/sys-root/mingw/bin/libpangowin32-1.0-0.dll 
${destdir}/bin
cp /usr/x86_64-w64-mingw32/sys-root/mingw/bin/libpixman-1-0.dll ${destdir}/bin
cp /usr/x86_64-w64-mingw32/sys-root/mingw/bin/libpng15-15.dll ${destdir}/bin
cp /usr/x86_64-w64-mingw32/sys-root/mingw/bin/libxml2-2.dll ${destdir}/bin
cp /usr/x86_64-w64-mingw32/sys-root/mingw/bin/libdl.dll ${destdir}/bin
cp /usr/x86_64-w64-mingw32/sys-root/mingw/bin/pthreadGC2.dll ${destdir}/bin
cp /usr/x86_64-w64-mingw32/sys-root/mingw/bin/zlib1.dll ${destdir}/bin
cp /usr/x86_64-w64-mingw32/sys-root/mingw/bin/libffi-6.dll ${destdir}/bin
cp /usr/x86_64-w64-mingw32/sys-root/mingw/bin/libpangoft2-1.0-0.dll 
${destdir}/bin
cp /usr/x86_64-w64-mingw32/sys-root/mingw/bin/libfontconfig-1.dll ${destdir}/bin
cp /usr/x86_64-w64-mingw32/sys-root/mingw/bin/libexpat-1.dll ${destdir}/bin
cp /usr/x86_64-w64-mingw32/sys-root/mingw/bin/libfreetype-6.dll ${destdir}/bin
cp /usr/x86_64-w64-mingw32/sys-root/mingw/bin/libgdk-3-0.dll ${destdir}/bin
cp /usr/x86_64-w64-mingw32/sys-root/mingw/bin/libgtk-3-0.dll ${destdir}/bin
cp /usr/x86_64-w64-mingw32/sys-root/mingw/bin/libcairo-gobject-2.dll 
${destdir}/bin

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

Re: GTK app development for windows.

2013-01-30 Thread Andrew Potter

 On 01/30/2013 01:08 PM, John Stebbins wrote:
  I realized I didn't answer your question completely.  My installer is
 just a zip file containing the directory tree of
  everything needed.  I have a simple script that copies everything needed
 into the directory, then I zip it up.  Example
  script attached.


Oh, this is really helpful for me! Thank you.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Threads and gtk_widget_show (code should not be reached?)

2013-01-30 Thread Ferdinand Ramirez
I used the gdk_threads_enter/gdk_threads_leave pair, but it did not work. It 
does not work even when the whole creation of the hierarchy is within the 
gdk_threads_enter/gdk_threads_leave pair.

I am able to get it to work without using GtkEntry instead of GtkTextView if I 
call the function in main().

However, as I pointed out, it works if I replace the GtkTextView with a 
GtkEntry within each cell of the table. 

-Ferdinand

--- On Wed, 1/30/13, Edscott Wilson edscott.wilson.gar...@gmail.com wrote:

 The current method for calling gtk_xx
 instructions is from the main thread
 only (i.e., that which owns the main loop context). You can
 do this by
 means of g_main_context_invoke(). Otherwise you must use the
 deprecated
 gdk_threads_enter/gdk_threads_leave mutex method. The
 deprecated method is
 slower.
 
 If you do not do the above, you will get all sort of errors
 just like the
 one you describe.
 
 HTH
 
 2013/1/30 Ferdinand Ramirez ramirez.ferdin...@yahoo.com
 
  I have encountered a strange error followed by a crash
 when I add the
  following object to a GtkTextView by creating a child
 anchor and call
  gtk_widget_show_all.
 
  The object that is added
 
  The object that is added to the child anchor is a
 GtkFrame inside which is
  a GtkTable and each cell of the table contains another
 GtkFrame each of
  which contains a GtkTextView.
 
  The error
 
  This works fine if it is all done from the main
 program. However, when I
  create the hierarchy described above in another thread
 and call
  gtk_widget_show_all on the GtkFrame that is added, I
 get an error in paint
  saying code should not be reached. Before this error,
 there is a warning
  that the iterator in text view has changed. I am not
 sure if the warning
  and error are related.
 
  Source of the error
 
  I replaced gtk_widget_show_all by gtk_widget_show in a
 loop going down the
  tree and calling it for each object. The source of the
 error was the
  gtk_widget_show on the leaf level view objects in the
 frames contained in
  each cell of the table.
 
  Situations under which it works
 
  When the leaf level GtkTextView objects are not part of
 the hierarchy of
  widgets I create or they are replaced by GtkEntry
 objects, everything works
  fine. Again, note that it also works fine if I do not
 have another thread
  and call everything from the main program on startup
 but I need to have
  another thread as this object will be created during
 the course of the
  program. I've tried both g_idle_add as well as using
 the
  gdk_threads_enter/leave pair.
 
  Any help will be appreciated.
 
  -Ferdinand
  ___
  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: Threads and gtk_widget_show (code should not be reached?)

2013-01-30 Thread Andrew Potter
On Wed, Jan 30, 2013 at 2:17 PM, Ferdinand Ramirez 
ramirez.ferdin...@yahoo.com wrote:

 However, as I pointed out, it works if I replace the GtkTextView with a
 GtkEntry within each cell of the table.
  2013/1/30 Ferdinand Ramirez ramirez.ferdin...@yahoo.com
   This works fine if it is all done from the main program. However, when
 I
   create the hierarchy described above in another thread and call
   gtk_widget_show_all on the GtkFrame that is added, I get an error in
 paint
   saying code should not be reached. Before this error, there is a
 warning
   that the iterator in text view has changed. I am not sure if the
 warning
   and error are related.


If you are getting an iterator warning, you may be trying to use an
invalidated GtkTextIter. Be sure to read
http://developer.gnome.org/gtk3/stable/TextWidget.html

Particularly,Iterators are not valid indefinitely; whenever the buffer is
modified in a way that affects the number of characters in the buffer, all
outstanding iterators become invalid. (Note that deleting 5 characters and
then reinserting 5 still invalidates iterators, though you end up with the
same number of characters you pass through a state with a different number).

Because of this, iterators can't be used to preserve positions across
buffer modifications.

Using an invalid iter is essentially the same as writing data randomly to
memory. The GtkEntry probably works because it doesn't have a
GtkTextBuffer/Iter.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Threads and gtk_widget_show (code should not be reached?)

2013-01-30 Thread Ferdinand Ramirez
--- On Wed, 1/30/13, Andrew Potter agpot...@gmail.com wrote:
 
 If you are getting an iterator warning, you may be trying to
 use an
 invalidated GtkTextIter. Be sure to read
 http://developer.gnome.org/gtk3/stable/TextWidget.html

I have nothing in there that modifies the buffer. I just create the view and 
add it. In fact, the error comes from the line gtk_widget_show_all. If I 
replace this line with code to traverse the hierarchy and do a gtk_widget_show 
on each object, the error manifests itself only when I get to the GtkTextView 
at the leaf nodes. 

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


Re: Threads and gtk_widget_show (code should not be reached?)

2013-01-30 Thread Andrew Potter
On Wed, Jan 30, 2013 at 8:11 PM, Ferdinand Ramirez 
ramirez.ferdin...@yahoo.com wrote:

 I have nothing in there that modifies the buffer. I just create the view
 and add it. In fact, the error comes from the line gtk_widget_show_all. If
 I replace this line with code to traverse the hierarchy and do a
 gtk_widget_show on each object, the error manifests itself only when I get
 to the GtkTextView at the leaf nodes.


Unless anyone else has some bright ideas, it would be helpful if you could
post a concise test case.

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