Re: GtkFileChooserDialog: something funny?

2008-09-26 Thread Allin Cottrell
On Fri, 26 Sep 2008, Michael Natterer wrote:

> On Fri, 2008-09-26 at 14:29 -0400, Allin Cottrell wrote:
> > On Fri, 26 Sep 2008, Tor Lillqvist wrote:
> > 
> > > > Any ideas on what's going on?
> > > 
> > > http://bugzilla.gnome.org/show_bug.cgi?id=553135#c8 ?
> > 
> > On closer inspection, I see that Michael Natterer's patch is 
> > already in gtk 2.14.3, and does not solve the problem I mentioned, 
> > namely
> 
> No that patch is not in 2.14.3 unfortunately.
> 
> > GLib-GObject-CRITICAL **: g_object_unref: assertion `G_IS_OBJECT 
> > (object)' failed
> > 
> > on calling gtk_widget_destroy() on a GtkFileChooserDialog.
> > I guess this patch was incomplete or broken in its application to
> > 2.14.3.  Line 937 in gtkfilechooserdefault.c, namely
> > 
> >   g_object_unref (impl->file_system);
> > 
> > needs to be deleted.
> 
> That's exactly what the patch does.

Ah, then the wrong patch is attached in bugzilla.
http://bugzilla.gnome.org/attachment.cgi?id=119181

-- 
Allin Cottrell
Department of Economics
Wake Forest University

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


possible memory leak help.

2008-09-26 Thread alee

Hi,
I have a memory leak problem which I can't seem to understand.

I have a GtkTreeview/ GtkTreeModelFilter/ GtkTreeStore setup.
I have traced it to a case where memory leaks when I call 
"gtk_tree_store_set" multiple times.


Here is a snipnet of my code demonstrating the problem.  Am I suppose to 
free something but I didn't?


... I have selection change call back function setup...

g_signal_connect (G_OBJECT (select), "changed",
 G_CALLBACK (FilterviewSelectionChanged_cb), NULL);

void FilterviewSelectionChanged_cb(GtkTreeSelection *sel, gpointer data)
{
  GtkTreeIter iter;
  GtkTreeModel *model;
  gboolean col0;
  gchar *col1;
  GString *key_col1;
  GTree *list;

  if (gtk_tree_selection_get_selected (sel,&model,&iter))
  {
 gtk_tree_model_get (model,&iter,0,&col0, -1);
 gtk_tree_model_get (model,&iter,1,&col1, -1);
 g_print ("filterview row selected, col0: %d, col1: %s\n", col0,col1);

 key_col1 = g_string_new (col1);
 list = g_tree_lookup (filterlists, key_col1);
 if (list) //found
 {   
 //Not calling GameviewDispalyGTree(list) doesn't seem to show 
much
 //memory leak... Lets follow it and see what 
GameviewDisplayGTree is doing...

GameviewDisplayGTree(list);
 }
   
 g_free (col1);

 g_string_free (key_col1, TRUE);
  }
}

void GameviewDisplayGTree ( GTree *treelist )
{
  GtkTreeModel *mod;
  gchar str_buf[64];

  printf("GameviewDisplayGTree...\n");

  mod = gtk_tree_model_filter_get_model(
   GTK_TREE_MODEL_FILTER(gameview_treefilt_model));

  //Not calling gtk_tree_model_foreach (mod, GameviewDisplayGTreeItem, 
treelist)
  //doesn't seem to show much memory leak... Checkout 
GameviewDisplayGTreeItem.
  gtk_tree_model_foreach (mod, GameviewDisplayGTreeItem, treelist);


}

gboolean GameviewDisplayGTreeItem(GtkTreeModel *model,GtkTreePath *path,
 GtkTreeIter *iter, gpointer treelist)
{
  gchar *char_name;
  gint hide_cnt;

  GString *name;
  GString *value;

   /**/
   /*# Memory leaks if I call gtk_tree_store_set many times #*/
   int i=0;
   for (i=0; i<50; i++)
   {
   printf("GameviewDisplayGTreeItem hide/unhide i: %d\n",i);
  gtk_tree_store_set(GTK_TREE_STORE(model),iter,BOOL_VISIBLE,FALSE,-1);
  gtk_tree_store_set(GTK_TREE_STORE(model),iter,BOOL_VISIBLE,TRUE,-1);
  }
   /*#*/

//   g_string_free (name, TRUE);
//   g_free (char_name);

  return FALSE; //continue traversing.
}


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


Re: GtkFileChooserDialog: something funny?

2008-09-26 Thread Allin Cottrell
On Fri, 26 Sep 2008, Tor Lillqvist wrote:

> > Any ideas on what's going on?
> 
> http://bugzilla.gnome.org/show_bug.cgi?id=553135#c8 ?

On closer inspection, I see that Michael Natterer's patch is 
already in gtk 2.14.3, and does not solve the problem I mentioned, 
namely

GLib-GObject-CRITICAL **: g_object_unref: assertion `G_IS_OBJECT 
(object)' failed

on calling gtk_widget_destroy() on a GtkFileChooserDialog.
I guess this patch was incomplete or broken in its application to
2.14.3.  Line 937 in gtkfilechooserdefault.c, namely

  g_object_unref (impl->file_system);

needs to be deleted.

-- 
Allin Cottrell
Department of Economics
Wake Forest University

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


Re: GtkFileChooserDialog: something funny?

2008-09-26 Thread Allin Cottrell
On Fri, 26 Sep 2008, Tor Lillqvist wrote:

> > Any ideas on what's going on?
> 
> http://bugzilla.gnome.org/show_bug.cgi?id=553135#c8 ?

Thanks, got it.

-- 
Allin Cottrell
Department of Economics
Wake Forest University

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


Re: Why is minimizing an app and switching the desktop resulting in the same window-event: ICONIFIED ?

2008-09-26 Thread Rorschach
Really noone any ideo how to hide a window to tray when minimized but not when 
moving to another desktop with gtk?



On Wed, 17 Sep 2008 19:57:05 +0200
Rorschach <[EMAIL PROTECTED]> wrote:

> Hi,
> I'm writing a trayicon (gtk-status-icon) in C for a linux-application. I 
> created an event-handler for window-state-events. When the window gets 
> minimized I wanna hide it to the tray. That means if the changed_mask and 
> new_window_state become GDK_WINDOW_STATE_ICONIFIED.
> 
> But my problem is that also just switching to another desktop under X results 
> in the state-handler to get executed and the window gets the ICONIFIED-state. 
> Why is minimizing a window and switching the desktop are having the same 
> state in GDK?
> 
> Here a little proof:
> 
> #include 
> #include 
> 
> gboolean window_state_event (GtkWidget *widget, GdkEventWindowState *event)
> {
> printf("%d\n",event->changed_mask);
> printf("%d\n\n",event->new_window_state);
> return TRUE;
> } 
> 
> int main( int   argc,char *argv[] )
> {
> GtkWidget *window;
> 
> gtk_init (&argc, &argv);
> window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
> gtk_widget_show (window);
> g_signal_connect (G_OBJECT (window), "window-state-event", G_CALLBACK 
> (window_state_event),NULL); 
> gtk_main();
> 
> return 0;
> }
> 
> Just compile with:
>   gcc test.c -o test -Wall -Werror -pedantic `pkg-config --cflags --libs 
> gtk+-2.0`
> 
> And now you can test it. Minimize the window, which results in:
> 2
> 2
> or switch the desktop while the window is visible, again:
> 2
> 2
> 
> So now for my problem: when I code a trayicon I wanna hide it when it gets 
> minimized but not! when a user switched the desktop. This seems impossible 
> because the event is the same. Do you have any idea, any thoughts with this? 
> Any help or hint is really appreatiated!
> 
> cu



regards
 Rorschach

--
Mail: [EMAIL PROTECTED] (pgp: 0xD6DEB90A)
Irc : Rorschach on irc.freenode.net
Web : http://rorschachstagebuch.wordpress.com
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: GtkFileChooserDialog: something funny?

2008-09-26 Thread Tor Lillqvist
> Any ideas on what's going on?

http://bugzilla.gnome.org/show_bug.cgi?id=553135#c8 ?

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


GtkFileChooserDialog: something funny?

2008-09-26 Thread Allin Cottrell
After updating to glib 2.18.1, gtk 2.14.3 and pango 1.22.0
I'm seeing some funny behavior from GtkFileChooserDialog,
which has started to emit a GLib-GObject-CRITICAL message
on destruction.

Simple test case, based on the example in the documentation
for GtkFileChooserDialog:

void gtk_file_selector_dummy (void) 
{
GtkWidget *dialog;

dialog = 
gtk_file_chooser_dialog_new("Open File",
NULL,
GTK_FILE_CHOOSER_ACTION_OPEN,
GTK_STOCK_CANCEL, 
GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, 
GTK_RESPONSE_ACCEPT,
NULL);

if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) 
{
gchar *filename;

filename = 
  gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
fprintf(stderr, "got filename '%s'\n", filename);
g_free(filename);
}

fprintf(stderr, "destroying dialog\n");
gtk_widget_destroy(dialog);
fprintf(stderr, "dialog destroyed\n");
}

When I invoke this function I get:

destroying dialog

(gretl:15258): GLib-GObject-CRITICAL **: g_object_unref: assertion 
`G_IS_OBJECT (object)' failed
dialog destroyed

Any ideas on what's going on?

-- 
Allin Cottrell
Department of Economics
Wake Forest University

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


Re: Learning Glade

2008-09-26 Thread Murray Cumming
On Fri, 2008-09-26 at 02:31 -0400, Ruben Safir wrote:
> On Mon, Apr 28, 2008 at 08:01:13PM +0200, Luis Menina wrote:
> > If you have a recent version of GTK+ (>= 2.12), just go with GtkBuilder 
> > instead of libglade: this is the way things should be done nowadays, if 
> > you create a simple interface (GtkBuilder is still young).
> > 
> > You can design your graphical interface with glade, or gazpacho, or any 
> > tool that will produce *.glade files. Then you use gtk-builder-convert 
> > to generate *.ui files that GtkBuilder will be able to use.
> > http://library.gnome.org/devel/gtk/2.12/gtk-builder-convert.html
> 
> Will that work for C++ as well?

Yes, with Gtk::Builder.

Note that very new versions of glade-3 can produce GtkBuilder files. 

-- 
[EMAIL PROTECTED]
www.murrayc.com
www.openismus.com

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


Transparent Draw Area

2008-09-26 Thread michael

Hi all,

I want to create a transparent draw area and using cairo to draw line
with the window background.
My backed is directfb and I don't know if it is supported. I want to
start with an example working on X.

Is there somenthing attribute or function to do this?

Regards Michael



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


gtk+ signal handler problem

2008-09-26 Thread Orcan Kolankaya
Hi, i will really appreciate if anyone can help me!
I have just started to use gtk+ and glade with dev-cpp in windows, and i ve
been following the tutorial,
http://www.micahcarrick.com/12-24-2007/gtk-glade-tutorial-part-1.html#Introduction_to_Glade3..
Finally i have managed to compile and run the sample tutorial code
successfully with dev-cpp.. But i suppose  there was a problem with the
signal handling of gtk.. I ve googled it for hours, and came up with a
solution : updating the cross-linker of mingw.. But i could not find out how
to update it...  I cant get rid of that GTK-warning: could not find signal
handler..
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: simple question about gtk_notebook

2008-09-26 Thread Vasiliy Tolstov
On Fri, 2008-09-26 at 11:26 +0200, Damien Caliste wrote:
> Hello,
> 
> Le 26/09/2008, Vasiliy Tolstov <[EMAIL PROTECTED]> a écrit :
> > Hello. 
> > 
> > I have this code (window with 2 tabs), if i'm try to run - displays
> > only window without tabs, where is error ?
> Isn't the gtk_container_add(GTK_CONTAINER(window), notebook); missing?
> 
> Damien.

Thank You! I'm stupid =(


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

Re: simple question about gtk_notebook

2008-09-26 Thread Damien Caliste
Hello,

Le 26/09/2008, Vasiliy Tolstov <[EMAIL PROTECTED]> a écrit :
> Hello. 
> 
> I have this code (window with 2 tabs), if i'm try to run - displays
> only window without tabs, where is error ?
Isn't the gtk_container_add(GTK_CONTAINER(window), notebook); missing?

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

simple question about gtk_notebook

2008-09-26 Thread Vasiliy Tolstov
Hello. 

I have this code (window with 2 tabs), if i'm try to run - displays only
window without tabs, where is error ?

  gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Services");
gtk_window_set_position (GTK_WINDOW (window),
GTK_WIN_POS_CENTER);
gtk_container_set_border_width (GTK_CONTAINER (window), 1);
gtk_widget_set_size_request (window, 640, 480);
gtk_window_set_default (GTK_WINDOW (window), NULL);
g_signal_connect (window, "destroy", G_CALLBACK (signal_quit),
NULL);
g_signal_connect (window, "key_press_event", G_CALLBACK
(signal_keypress), NULL);

notebook = gtk_notebook_new ();
gtk_notebook_set_tab_pos (GTK_NOTEBOOK (notebook), GTK_POS_TOP);


startup_label = gtk_label_new ("Startup Programs");
running_label = gtk_label_new ("Running Programs");

startup = gtk_frame_new (NULL);
running = gtk_frame_new (NULL);

gtk_notebook_append_page (GTK_NOTEBOOK (notebook), startup,
startup_label);
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), running,
running_label);
  gtk_widget_show (notebook);
gtk_widget_show (startup);
gtk_widget_show (running);

gtk_widget_show (running_label);
gtk_widget_show (running_label);
 gtk_widget_show (window);
gtk_main ();

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