Re: The best way to use Glade generated code : suggestions to newbies from a newbie



On Sun, 22 Feb 2004, Manish Chakravarty wrote:

Hi Manish & fellow newbies, greetings to pros,

Just discovered a method which takes care of all those variabe problems in
Glade and makes coding hassle free:

  I'm a Glade/GTK newbie as well. If I understand the problem you're
referring to, then perhaps what I did in my gppp code will provide some
help:

1) Get Glade to generate all its code.
2) Write a widget_util.h & widget_util.c (or similar) with

#include "support.h"

GtkWidget *preferences = NULL;

GtkWidget *
get_preferences_window (void)
{
  if (preferences == NULL)
    return (preferences = create_preferences_window ());
  else
    return preferences;
}

and some utility functions such as

set_widget_blah (GtkWidget *widget, const gchar *control)
{
  GtkWidget *w = lookup_widget (widget, control);
  if (w != NULL)
    gtk_set_widget_blah (w);
  else
    g_warning ("not setting blah of unknown widget: %s", control);
}

Am I off the mark here?

By the way, I make extensive use of "lookup_widget" function and find it
to be most attractive means of manipulating widgets.


Wayward Bruce - Yet Another Kind of Bruces
---
http://www.rcub.bg.ac.yu/~bruce
bruce tesla rcub bg ac yu



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]