[Glade-users] I wait for your answer about GTK+ and glade



--0-1031090613-1073196504=:84139
Content-Type: text/plain; charset=us-ascii

Thank u for answer me!
I write a simple code for my question (use GLADE):
    interface.c
/*
 * DO NOT EDIT THIS FILE - it is generated by Glade.
 */
#ifdef HAVE_CONFIG_H
#  include <config.h>
#endif
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
#include "callbacks.h"
#include "interface.h"
#include "support.h"
#define GLADE_HOOKUP_OBJECT(component,widget,name) \
  g_object_set_data_full (G_OBJECT (component), name,
\
    gtk_widget_ref (widget), (GDestroyNotify)
gtk_widget_unref)
#define
GLADE_HOOKUP_OBJECT_NO_REF(component,widget,name) \
  g_object_set_data (G_OBJECT (component), name,
widget)
GtkWidget*
create_window1 (void)
{
  GtkWidget *window1;
  GtkWidget *vbox1;
  GtkWidget *button101;
  GtkWidget *button102;
  GtkWidget *label103;
  window1 = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_widget_set_name (window1, "window1");
  gtk_window_set_title (GTK_WINDOW (window1),
_("window1"));
  vbox1 = gtk_vbox_new (FALSE, 0);
  gtk_widget_set_name (vbox1, "vbox1");
  gtk_widget_show (vbox1);
  gtk_container_add (GTK_CONTAINER (window1), vbox1);
  button101 = gtk_button_new_with_mnemonic
(_("button101"));
  gtk_widget_set_name (button101, "button101");
  gtk_widget_show (button101);
  gtk_box_pack_start (GTK_BOX (vbox1), button101,
FALSE, FALSE, 0);
  button102 = gtk_button_new_with_mnemonic
(_("button102"));
  gtk_widget_set_name (button102, "button102");
  gtk_widget_show (button102);
  gtk_box_pack_start (GTK_BOX (vbox1), button102,
FALSE, FALSE, 0);
  gtk_widget_set_sensitive (button102, FALSE);
  label103 = gtk_label_new (_("I am 1"));
  gtk_widget_set_name (label103, "label103");
  gtk_widget_show (label103);
  gtk_box_pack_start (GTK_BOX (vbox1), label103,
FALSE, FALSE, 0);
  gtk_label_set_justify (GTK_LABEL (label103),
GTK_JUSTIFY_LEFT);
  g_signal_connect ((gpointer) button101, "clicked",
                    G_CALLBACK (on_button1_clicked),
                    NULL);
  g_signal_connect ((gpointer) button102, "clicked",
                    G_CALLBACK (on_button1_clicked),
                    NULL);
  /* Store pointers to all widgets, for use by
lookup_widget(). */
  GLADE_HOOKUP_OBJECT_NO_REF (window1, window1,
"window1");
  GLADE_HOOKUP_OBJECT (window1, vbox1, "vbox1");
  GLADE_HOOKUP_OBJECT (window1, button101,
"button101");
  GLADE_HOOKUP_OBJECT (window1, button102,
"button102");
  GLADE_HOOKUP_OBJECT (window1, label103, "label103");
  return window1;
}
GtkWidget*
create_window2 (void)
{
  GtkWidget *window2;
  GtkWidget *vbox2;
  GtkWidget *button201;
  GtkWidget *button202;
  window2 = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_widget_set_name (window2, "window2");
  gtk_window_set_title (GTK_WINDOW (window2),
_("window2"));
  vbox2 = gtk_vbox_new (FALSE, 0);
  gtk_widget_set_name (vbox2, "vbox2");
  gtk_widget_show (vbox2);
  gtk_container_add (GTK_CONTAINER (window2), vbox2);
  button201 = gtk_button_new_with_mnemonic
(_("button201"));
  gtk_widget_set_name (button201, "button201");
  gtk_widget_show (button201);
  gtk_box_pack_start (GTK_BOX (vbox2), button201,
FALSE, FALSE, 0);
  button202 = gtk_button_new_with_mnemonic
(_("button202"));
  gtk_widget_set_name (button202, "button202");
  gtk_widget_show (button202);
  gtk_box_pack_start (GTK_BOX (vbox2), button202,
FALSE, FALSE, 0);
  g_signal_connect ((gpointer) button201, "clicked",
                    G_CALLBACK (on_button2_clicked),
                    NULL);
  g_signal_connect ((gpointer) button202, "clicked",
                    G_CALLBACK (on_button2_clicked),
                    NULL);
  /* Store pointers to all widgets, for use by
lookup_widget(). */
  GLADE_HOOKUP_OBJECT_NO_REF (window2, window2,
"window2");
  GLADE_HOOKUP_OBJECT (window2, vbox2, "vbox2");
  GLADE_HOOKUP_OBJECT (window2, button201,
"button201");
  GLADE_HOOKUP_OBJECT (window2, button202,
"button202");
  return window2;
}
 
   callbacks.c
#ifdef HAVE_CONFIG_H
#  include <config.h>
#endif
#include <gtk/gtk.h>
#include "callbacks.h"
#include "interface.h"
#include "support.h"

void
on_button1_clicked                     (GtkButton     
 *button,
                                        gpointer      
  user_data)
{
 GtkWidget *window2;
 window2 = create_window2 ();
   gtk_widget_show (window2);
}

void
on_button2_clicked                     (GtkButton     
 *button,
                                        gpointer      
  user_data)
{
 GtkWidget *button102;
 GtkWidget *label103;

label103=lookup_widget(GTK_WIDGET(button),"label103");
 gtk_label_set_text(GTK_LABEL(label103),"I am 2");

button102=lookup_widget(GTK_WIDGET(button),"button102");
 gtk_widget_set_sensitive(GTK_WIDGET(button102),TRUE);
}
 
    main.c
/*
 * Initial main.c file generated by Glade. Edit as
required.
 * Glade will not overwrite this file.
 */
#ifdef HAVE_CONFIG_H
#  include <config.h>
#endif
#include <gtk/gtk.h>
#include "interface.h"
#include "support.h"
int
main (int argc, char *argv[])
{
  GtkWidget *window1;
  //GtkWidget *window2;
#ifdef ENABLE_NLS
  bindtextdomain (GETTEXT_PACKAGE,
PACKAGE_LOCALE_DIR);
  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
  textdomain (GETTEXT_PACKAGE);
#endif
  gtk_set_locale ();
  gtk_init (&argc, &argv);
  add_pixmap_directory (PACKAGE_DATA_DIR "/" PACKAGE
"/pixmaps");
  /*
   * The following code was added by Glade to create
one of each component
   * (except popup menus), just so that you see
something after building
   * the project. Delete any components that you don't
want shown initially.
   */
  window1 = create_window1 ();
  gtk_widget_show (window1);
  //window2 = create_window2 ();
  //gtk_widget_show (window2);
  gtk_main ();
  return 0;
}
 
      support.c
/*
 * DO NOT EDIT THIS FILE - it is generated by Glade.
 */
#ifdef HAVE_CONFIG_H
#  include <config.h>
#endif
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>
#include <gtk/gtk.h>
#include "support.h"
GtkWidget*
lookup_widget                          (GtkWidget     
 *widget,
                                        const gchar   
 *widget_name)
{
  GtkWidget *parent, *found_widget;
  for (;;)
    {
      if (GTK_IS_MENU (widget))
        parent = gtk_menu_get_attach_widget (GTK_MENU
(widget));
      else
        parent = widget->parent;
      if (!parent)
        parent = (GtkWidget*) g_object_get_data
(G_OBJECT (widget), "GladeParentKey");
      if (parent == NULL)
        break;
      widget = parent;
    }
  found_widget = (GtkWidget*) g_object_get_data
(G_OBJECT (widget),
                                                
widget_name);
  if (!found_widget)
    g_warning ("Widget not found: %s", widget_name);
  return found_widget;
}
static GList *pixmaps_directories = NULL;
/* Use this function to set the directory containing
installed pixmaps. */
void
add_pixmap_directory                   (const gchar   
 *directory)
{
  pixmaps_directories = g_list_prepend
(pixmaps_directories,
                                        g_strdup
(directory));
}
/* This is an internally used function to find pixmap
files. */
static gchar*
find_pixmap_file                       (const gchar   
 *filename)
{
  GList *elem;
  /* We step through each of the pixmaps directory to
find it. */
  elem = pixmaps_directories;
  while (elem)
    {
      gchar *pathname = g_strdup_printf ("%s%s%s",
(gchar*)elem->data,
                                        
G_DIR_SEPARATOR_S, filename);
      if (g_file_test (pathname, G_FILE_TEST_EXISTS))
        return pathname;
      g_free (pathname);
      elem = elem->next;
    }
  return NULL;
}
/* This is an internally used function to create
pixmaps. */
GtkWidget*
create_pixmap                          (GtkWidget     
 *widget,
                                        const gchar   
 *filename)
{
  gchar *pathname = NULL;
  GtkWidget *pixmap;
  if (!filename || !filename[0])
      return gtk_image_new ();
  pathname = find_pixmap_file (filename);
  if (!pathname)
    {
      g_warning (_("Couldn't find pixmap file: %s"),
filename);
      return gtk_image_new ();
    }
  pixmap = gtk_image_new_from_file (pathname);
  g_free (pathname);
  return pixmap;
}
/* This is an internally used function to create
pixmaps. */
GdkPixbuf*
create_pixbuf                          (const gchar   
 *filename)
{
  gchar *pathname = NULL;
  GdkPixbuf *pixbuf;
  GError *error = NULL;
  if (!filename || !filename[0])
      return NULL;
  pathname = find_pixmap_file (filename);
  if (!pathname)
    {
      g_warning (_("Couldn't find pixmap file: %s"),
filename);
      return NULL;
    }
  pixbuf = gdk_pixbuf_new_from_file (pathname,
&error);
  if (!pixbuf)
    {
      fprintf (stderr, "Failed to load pixbuf file:
%s: %s\n",
               pathname, error->message);
      g_error_free (error);
    }
  g_free (pathname);
  return pixbuf;
}
/* This is used to set ATK action descriptions. */
void
glade_set_atk_action_description       (AtkAction     
 *action,
                                        const gchar   
 *action_name,
                                        const gchar   
 *description)
{
  gint n_actions, i;
  n_actions = atk_action_get_n_actions (action);
  for (i = 0; i < n_actions; i++)
    {
      if (!strcmp (atk_action_get_name (action, i),
action_name))
        atk_action_set_description (action, i,
description);
    }
}

Sorry,so stupid a question to bother you again.
 


---------------------------------
Do you Yahoo!?
Yahoo! Photos - Get your photo on the big screen in Times Square
--0-1031090613-1073196504=:84139
Content-Type: text/html; charset=us-ascii

<DIV>Thank u for answer me!</DIV>
<DIV>I write a simple code for my question (use GLADE):</DIV>
<DIV>&nbsp;&nbsp;&nbsp; interface.c</DIV>
<DIV>/*<BR>&nbsp;* DO NOT EDIT THIS FILE - it is generated by Glade.<BR>&nbsp;*/</DIV>
<DIV>#ifdef HAVE_CONFIG_H<BR>#&nbsp; include &lt;config.h&gt;<BR>#endif</DIV>
<DIV>#include &lt;sys/types.h&gt;<BR>#include &lt;sys/stat.h&gt;<BR>#include &lt;unistd.h&gt;<BR>#include 
&lt;string.h&gt;<BR>#include &lt;stdio.h&gt;</DIV>
<DIV>#include &lt;gdk/gdkkeysyms.h&gt;<BR>#include &lt;gtk/gtk.h&gt;</DIV>
<DIV>#include "callbacks.h"<BR>#include "interface.h"<BR>#include "support.h"</DIV>
<DIV>#define GLADE_HOOKUP_OBJECT(component,widget,name) \<BR>&nbsp; g_object_set_data_full (G_OBJECT 
(component), name,<BR>\<BR>&nbsp;&nbsp;&nbsp; gtk_widget_ref (widget), 
(GDestroyNotify)<BR>gtk_widget_unref)</DIV>
<DIV>#define<BR>GLADE_HOOKUP_OBJECT_NO_REF(component,widget,name) \<BR>&nbsp; g_object_set_data (G_OBJECT 
(component), name,<BR>widget)</DIV>
<DIV>GtkWidget*<BR>create_window1 (void)<BR>{<BR>&nbsp; GtkWidget *window1;<BR>&nbsp; GtkWidget 
*vbox1;<BR>&nbsp; GtkWidget *button101;<BR>&nbsp; GtkWidget *button102;<BR>&nbsp; GtkWidget *label103;</DIV>
<DIV>&nbsp; window1 = gtk_window_new (GTK_WINDOW_TOPLEVEL);<BR>&nbsp; gtk_widget_set_name (window1, 
"window1");<BR>&nbsp; gtk_window_set_title (GTK_WINDOW (window1),<BR>_("window1"));</DIV>
<DIV>&nbsp; vbox1 = gtk_vbox_new (FALSE, 0);<BR>&nbsp; gtk_widget_set_name (vbox1, "vbox1");<BR>&nbsp; 
gtk_widget_show (vbox1);<BR>&nbsp; gtk_container_add (GTK_CONTAINER (window1), vbox1);</DIV>
<DIV>&nbsp; button101 = gtk_button_new_with_mnemonic<BR>(_("button101"));<BR>&nbsp; gtk_widget_set_name 
(button101, "button101");<BR>&nbsp; gtk_widget_show (button101);<BR>&nbsp; gtk_box_pack_start (GTK_BOX 
(vbox1), button101,<BR>FALSE, FALSE, 0);</DIV>
<DIV>&nbsp; button102 = gtk_button_new_with_mnemonic<BR>(_("button102"));<BR>&nbsp; gtk_widget_set_name 
(button102, "button102");<BR>&nbsp; gtk_widget_show (button102);<BR>&nbsp; gtk_box_pack_start (GTK_BOX 
(vbox1), button102,<BR>FALSE, FALSE, 0);<BR>&nbsp; gtk_widget_set_sensitive (button102, FALSE);</DIV>
<DIV>&nbsp; label103 = gtk_label_new (_("I am 1"));<BR>&nbsp; gtk_widget_set_name (label103, 
"label103");<BR>&nbsp; gtk_widget_show (label103);<BR>&nbsp; gtk_box_pack_start (GTK_BOX (vbox1), 
label103,<BR>FALSE, FALSE, 0);<BR>&nbsp; gtk_label_set_justify (GTK_LABEL 
(label103),<BR>GTK_JUSTIFY_LEFT);</DIV>
<DIV>&nbsp; g_signal_connect ((gpointer) button101, 
"clicked",<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 G_CALLBACK 
(on_button1_clicked),<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 NULL);<BR>&nbsp; g_signal_connect ((gpointer) button102, 
"clicked",<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 G_CALLBACK 
(on_button1_clicked),<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 NULL);</DIV>
<DIV>&nbsp; /* Store pointers to all widgets, for use by<BR>lookup_widget(). */<BR>&nbsp; 
GLADE_HOOKUP_OBJECT_NO_REF (window1, window1,<BR>"window1");<BR>&nbsp; GLADE_HOOKUP_OBJECT (window1, vbox1, 
"vbox1");<BR>&nbsp; GLADE_HOOKUP_OBJECT (window1, button101,<BR>"button101");<BR>&nbsp; GLADE_HOOKUP_OBJECT 
(window1, button102,<BR>"button102");<BR>&nbsp; GLADE_HOOKUP_OBJECT (window1, label103, "label103");</DIV>
<DIV>&nbsp; return window1;<BR>}</DIV>
<DIV>GtkWidget*<BR>create_window2 (void)<BR>{<BR>&nbsp; GtkWidget *window2;<BR>&nbsp; GtkWidget 
*vbox2;<BR>&nbsp; GtkWidget *button201;<BR>&nbsp; GtkWidget *button202;</DIV>
<DIV>&nbsp; window2 = gtk_window_new (GTK_WINDOW_TOPLEVEL);<BR>&nbsp; gtk_widget_set_name (window2, 
"window2");<BR>&nbsp; gtk_window_set_title (GTK_WINDOW (window2),<BR>_("window2"));</DIV>
<DIV>&nbsp; vbox2 = gtk_vbox_new (FALSE, 0);<BR>&nbsp; gtk_widget_set_name (vbox2, "vbox2");<BR>&nbsp; 
gtk_widget_show (vbox2);<BR>&nbsp; gtk_container_add (GTK_CONTAINER (window2), vbox2);</DIV>
<DIV>&nbsp; button201 = gtk_button_new_with_mnemonic<BR>(_("button201"));<BR>&nbsp; gtk_widget_set_name 
(button201, "button201");<BR>&nbsp; gtk_widget_show (button201);<BR>&nbsp; gtk_box_pack_start (GTK_BOX 
(vbox2), button201,<BR>FALSE, FALSE, 0);</DIV>
<DIV>&nbsp; button202 = gtk_button_new_with_mnemonic<BR>(_("button202"));<BR>&nbsp; gtk_widget_set_name 
(button202, "button202");<BR>&nbsp; gtk_widget_show (button202);<BR>&nbsp; gtk_box_pack_start (GTK_BOX 
(vbox2), button202,<BR>FALSE, FALSE, 0);</DIV>
<DIV>&nbsp; g_signal_connect ((gpointer) button201, 
"clicked",<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 G_CALLBACK 
(on_button2_clicked),<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 NULL);<BR>&nbsp; g_signal_connect ((gpointer) button202, 
"clicked",<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 G_CALLBACK 
(on_button2_clicked),<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 NULL);</DIV>
<DIV>&nbsp; /* Store pointers to all widgets, for use by<BR>lookup_widget(). */<BR>&nbsp; 
GLADE_HOOKUP_OBJECT_NO_REF (window2, window2,<BR>"window2");<BR>&nbsp; GLADE_HOOKUP_OBJECT (window2, vbox2, 
"vbox2");<BR>&nbsp; GLADE_HOOKUP_OBJECT (window2, button201,<BR>"button201");<BR>&nbsp; GLADE_HOOKUP_OBJECT 
(window2, button202,<BR>"button202");</DIV>
<DIV>&nbsp; return window2;<BR>}</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;&nbsp; callbacks.c</DIV>
<DIV>#ifdef HAVE_CONFIG_H<BR>#&nbsp; include &lt;config.h&gt;<BR>#endif</DIV>
<DIV>#include &lt;gtk/gtk.h&gt;</DIV>
<DIV>#include "callbacks.h"<BR>#include "interface.h"<BR>#include "support.h"</DIV>
<DIV><BR>void<BR>on_button1_clicked&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 (GtkButton&nbsp;&nbsp;&nbsp;&nbsp; 
<BR>&nbsp;*button,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 gpointer&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp; user_data)<BR>{<BR>&nbsp;GtkWidget 
*window2;<BR>&nbsp;window2 = create_window2 ();<BR>&nbsp; &nbsp;gtk_widget_show (window2);</DIV>
<DIV>}</DIV>
<DIV><BR>void<BR>on_button2_clicked&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 (GtkButton&nbsp;&nbsp;&nbsp;&nbsp; 
<BR>&nbsp;*button,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 gpointer&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp; user_data)<BR>{<BR>&nbsp;GtkWidget 
*button102;<BR>&nbsp;GtkWidget *label103;</DIV>
<DIV><BR>label103=lookup_widget(GTK_WIDGET(button),"label103");<BR>&nbsp;gtk_label_set_text(GTK_LABEL(label103),"I
 am 2");</DIV>
<DIV><BR>button102=lookup_widget(GTK_WIDGET(button),"button102");<BR>&nbsp;gtk_widget_set_sensitive(GTK_WIDGET(button102),TRUE);<BR>}</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;&nbsp;&nbsp; main.c</DIV>
<DIV>/*<BR>&nbsp;* Initial main.c file generated by Glade. Edit as<BR>required.<BR>&nbsp;* Glade will not 
overwrite this file.<BR>&nbsp;*/</DIV>
<DIV>#ifdef HAVE_CONFIG_H<BR>#&nbsp; include &lt;config.h&gt;<BR>#endif</DIV>
<DIV>#include &lt;gtk/gtk.h&gt;</DIV>
<DIV>#include "interface.h"<BR>#include "support.h"</DIV>
<DIV>int<BR>main (int argc, char *argv[])<BR>{<BR>&nbsp; GtkWidget *window1;<BR>&nbsp; //GtkWidget 
*window2;</DIV>
<DIV>#ifdef ENABLE_NLS<BR>&nbsp; bindtextdomain (GETTEXT_PACKAGE,<BR>PACKAGE_LOCALE_DIR);<BR>&nbsp; 
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");<BR>&nbsp; textdomain (GETTEXT_PACKAGE);<BR>#endif</DIV>
<DIV>&nbsp; gtk_set_locale ();<BR>&nbsp; gtk_init (&amp;argc, &amp;argv);</DIV>
<DIV>&nbsp; add_pixmap_directory (PACKAGE_DATA_DIR "/" PACKAGE<BR>"/pixmaps");</DIV>
<DIV>&nbsp; /*<BR>&nbsp;&nbsp; * The following code was added by Glade to create<BR>one of each 
component<BR>&nbsp;&nbsp; * (except popup menus), just so that you see<BR>something after 
building<BR>&nbsp;&nbsp; * the project. Delete any components that you don't<BR>want shown 
initially.<BR>&nbsp;&nbsp; */<BR>&nbsp; window1 = create_window1 ();<BR>&nbsp; gtk_widget_show 
(window1);<BR>&nbsp; //window2 = create_window2 ();<BR>&nbsp; //gtk_widget_show (window2);</DIV>
<DIV>&nbsp; gtk_main ();<BR>&nbsp; return 0;<BR>}</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; support.c</DIV>
<DIV>/*<BR>&nbsp;* DO NOT EDIT THIS FILE - it is generated by Glade.<BR>&nbsp;*/</DIV>
<DIV>#ifdef HAVE_CONFIG_H<BR>#&nbsp; include &lt;config.h&gt;<BR>#endif</DIV>
<DIV>#include &lt;sys/types.h&gt;<BR>#include &lt;sys/stat.h&gt;<BR>#include &lt;unistd.h&gt;<BR>#include 
&lt;string.h&gt;<BR>#include &lt;stdio.h&gt;</DIV>
<DIV>#include &lt;gtk/gtk.h&gt;</DIV>
<DIV>#include "support.h"</DIV>
<DIV>GtkWidget*<BR>lookup_widget&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 (GtkWidget&nbsp;&nbsp;&nbsp;&nbsp; 
<BR>&nbsp;*widget,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 const gchar&nbsp;&nbsp; <BR>&nbsp;*widget_name)<BR>{<BR>&nbsp; GtkWidget *parent, *found_widget;</DIV>
<DIV>&nbsp; for (;;)<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (GTK_IS_MENU 
(widget))<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; parent = gtk_menu_get_attach_widget 
(GTK_MENU<BR>(widget));<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
parent = widget-&gt;parent;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if 
(!parent)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; parent = (GtkWidget*) g_object_get_data<BR>(G_OBJECT 
(widget), "GladeParentKey");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (parent == 
NULL)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; widget = 
parent;<BR>&nbsp;&nbsp;&nbsp; }</DIV>
<DIV>&nbsp; found_widget = (GtkWidget*) g_object_get_data<BR>(G_OBJECT 
(widget),<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 <BR>widget_name);<BR>&nbsp; if (!found_widget)<BR>&nbsp;&nbsp;&nbsp; g_warning ("Widget not found: %s", 
widget_name);<BR>&nbsp; return found_widget;<BR>}</DIV>
<DIV>static GList *pixmaps_directories = NULL;</DIV>
<DIV>/* Use this function to set the directory containing<BR>installed pixmaps. 
*/<BR>void<BR>add_pixmap_directory&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 (const gchar&nbsp;&nbsp; <BR>&nbsp;*directory)<BR>{<BR>&nbsp; pixmaps_directories = 
g_list_prepend<BR>(pixmaps_directories,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 g_strdup<BR>(directory));<BR>}</DIV>
<DIV>/* This is an internally used function to find pixmap<BR>files. */<BR>static 
gchar*<BR>find_pixmap_file&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 (const gchar&nbsp;&nbsp; <BR>&nbsp;*filename)<BR>{<BR>&nbsp; GList *elem;</DIV>
<DIV>&nbsp; /* We step through each of the pixmaps directory to<BR>find it. */<BR>&nbsp; elem = 
pixmaps_directories;<BR>&nbsp; while (elem)<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gchar 
*pathname = g_strdup_printf 
("%s%s%s",<BR>(gchar*)elem-&gt;data,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 <BR>G_DIR_SEPARATOR_S, filename);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (g_file_test (pathname, 
G_FILE_TEST_EXISTS))<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return 
pathname;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; g_free (pathname);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; elem = 
elem-&gt;next;<BR>&nbsp;&nbsp;&nbsp; }<BR>&nbsp; return NULL;<BR>}</DIV>
<DIV>/* This is an internally used function to create<BR>pixmaps. 
*/<BR>GtkWidget*<BR>create_pixmap&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 (GtkWidget&nbsp;&nbsp;&nbsp;&nbsp; 
<BR>&nbsp;*widget,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 const gchar&nbsp;&nbsp; <BR>&nbsp;*filename)<BR>{<BR>&nbsp; gchar *pathname = NULL;<BR>&nbsp; GtkWidget 
*pixmap;</DIV>
<DIV>&nbsp; if (!filename || !filename[0])<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return gtk_image_new ();</DIV>
<DIV>&nbsp; pathname = find_pixmap_file (filename);</DIV>
<DIV>&nbsp; if (!pathname)<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; g_warning (_("Couldn't 
find pixmap file: %s"),<BR>filename);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return gtk_image_new 
();<BR>&nbsp;&nbsp;&nbsp; }</DIV>
<DIV>&nbsp; pixmap = gtk_image_new_from_file (pathname);<BR>&nbsp; g_free (pathname);<BR>&nbsp; return 
pixmap;<BR>}</DIV>
<DIV>/* This is an internally used function to create<BR>pixmaps. 
*/<BR>GdkPixbuf*<BR>create_pixbuf&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 (const gchar&nbsp;&nbsp; <BR>&nbsp;*filename)<BR>{<BR>&nbsp; gchar *pathname = NULL;<BR>&nbsp; GdkPixbuf 
*pixbuf;<BR>&nbsp; GError *error = NULL;</DIV>
<DIV>&nbsp; if (!filename || !filename[0])<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return NULL;</DIV>
<DIV>&nbsp; pathname = find_pixmap_file (filename);</DIV>
<DIV>&nbsp; if (!pathname)<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; g_warning (_("Couldn't 
find pixmap file: %s"),<BR>filename);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return NULL;<BR>&nbsp;&nbsp;&nbsp; 
}</DIV>
<DIV>&nbsp; pixbuf = gdk_pixbuf_new_from_file (pathname,<BR>&amp;error);<BR>&nbsp; if 
(!pixbuf)<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fprintf (stderr, "Failed to load pixbuf 
file:<BR>%s: %s\n",<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
pathname, error-&gt;message);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; g_error_free (error);<BR>&nbsp;&nbsp;&nbsp; 
}<BR>&nbsp; g_free (pathname);<BR>&nbsp; return pixbuf;<BR>}</DIV>
<DIV>/* This is used to set ATK action descriptions. 
*/<BR>void<BR>glade_set_atk_action_description&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
(AtkAction&nbsp;&nbsp;&nbsp;&nbsp; 
<BR>&nbsp;*action,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 const gchar&nbsp;&nbsp; 
<BR>&nbsp;*action_name,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 const gchar&nbsp;&nbsp; <BR>&nbsp;*description)<BR>{<BR>&nbsp; gint n_actions, i;</DIV>
<DIV>&nbsp; n_actions = atk_action_get_n_actions (action);<BR>&nbsp; for (i = 0; i &lt; n_actions; 
i++)<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!strcmp (atk_action_get_name (action, 
i),<BR>action_name))<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; atk_action_set_description (action, 
i,<BR>description);<BR>&nbsp;&nbsp;&nbsp; }<BR>}</DIV>
<DIV><BR>Sorry,so stupid a question to bother you again.</DIV>
<DIV>&nbsp;</DIV><p><hr SIZE=1>
Do you Yahoo!?<br>
Yahoo! Photos - <a 
href="http://us.rd.yahoo.com/evt=21486/*http://f1.pg.photos.yahoo.com/ph//spsimplenol?.file=ny_ts_splash.html";>Get
 your photo on the big screen in Times Square</a>
--0-1031090613-1073196504=:84139--




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