[Glade-users] libglade: Autoconnect doesn't function
- From: daniel at dieterle.ws (Daniel Dieterle)
- Subject: [Glade-users] libglade: Autoconnect doesn't function
- Date: Tue, 22 May 2007 15:24:57 +0200
Hi everybody,
i made a first essay with Glade and his xml-capabilities.
But when i launch my app i get libglade warnings, and the button and
stuff doesn't work:
libglade-WARNING **: could not find signal handler
'on_button_start_clicked'
.
.
.
My c-code (the handlers are after the main-file defined):
#include <stdlib.h>
#include <stdio.h>
#include <gtk/gtk.h>
#include <glade/glade.h>
#include "handlers.h"
#define FILENAME "uiser.glade"
#define ROOTNODE "window1"
static GladeXML *xml;
int main(int argc, char **argv)
{
/* gtk+ init + glade init*/
gtk_init(&argc, &argv);
glade_init();
/* load the interface */
xml = glade_xml_new(FILENAME, ROOTNODE, NULL);
/* connect the signals in the interface */
glade_xml_signal_autoconnect(xml);
/* GtkWidget *curve;
curve = glade_xml_get_widget (xml, "curve1");
int veclen = 2;
gfloat vector[2];
gtk_curve_get_vector ((GtkCurve*)curve,
veclen,
vector);
int i;
for (i=0; i<2; i++) {
printf("Inhalt: %f", vector[i]);
}
*/
/* start the event loop */
gtk_main();
return 0;
}
My handlers file:
#include <gtk/gtk.h>
#define FILENAME "uiser.glade"
G_MODULE_EXPORT gboolean
on_window1_delete_event (GtkWidget *widget, GdkEvent *event, gpointer
user_data)
{
gtk_main_quit();
return FALSE;
}
void
on_new1_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_open1_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_save1_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_save_as1_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_quit1_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_cut1_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_copy1_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_paste1_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_delete1_activate (GtkMenuItem *menuitem,
gpointer user_data);
G_MODULE_EXPORT void
on_about1_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
glade_xml_new(FILENAME, "about", NULL);
// return NULL;
}
void
on_button_start_clicked (GtkButton *button,
gpointer user_data);
My xml-file:
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
<glade-interface>
<widget class="GtkWindow" id="window1">
<property name="visible">True</property>
<property name="title" translatable="yes">window1</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_CENTER</property>
<property name="modal">False</property>
<property name="default_width">600</property>
<property name="default_height">400</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">False</property>
<property name="decorated">True</property>
<property name="skip_taskbar_hint">False</property>
<property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<signal name="delete_event" handler="on_window1_delete_event"
last_modification_time="Wed, 16 May 2007 21:38:32 GMT"/>
<child>
<widget class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkMenuBar" id="menubar1">
<property name="visible">True</property>
<child>
<widget class="GtkMenuItem" id="menuitem1">
<property name="visible">True</property>
<property name="label" translatable="yes">_File</property>
<property name="use_underline">True</property>
<child>
<widget class="GtkMenu" id="menu1">
<child>
<widget class="GtkImageMenuItem" id="new1">
<property name="visible">True</property>
<property name="label">gtk-new</property>
<property name="use_stock">True</property>
<signal name="activate" handler="on_new1_activate"
last_modification_time="Tue, 15 May 2007 12:34:54 GMT"/>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="open1">
<property name="visible">True</property>
<property name="label">gtk-open</property>
<property name="use_stock">True</property>
<signal name="activate"
handler="on_open1_activate" last_modification_time="Tue, 15 May 2007
12:34:54 GMT"/>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="save1">
<property name="visible">True</property>
<property name="label">gtk-save</property>
<property name="use_stock">True</property>
<signal name="activate"
handler="on_save1_activate" last_modification_time="Tue, 15 May 2007
12:34:54 GMT"/>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="save_as1">
<property name="visible">True</property>
<property name="label">gtk-save-as</property>
<property name="use_stock">True</property>
<signal name="activate"
handler="on_save_as1_activate" last_modification_time="Tue, 15 May 2007
12:34:54 GMT"/>
</widget>
</child>
<child>
<widget class="GtkSeparatorMenuItem"
id="separatormenuitem1">
<property name="visible">True</property>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="quit1">
<property name="visible">True</property>
<property name="label">gtk-quit</property>
<property name="use_stock">True</property>
<signal name="activate"
handler="on_quit1_activate" last_modification_time="Tue, 15 May 2007
12:34:54 GMT"/>
</widget>
</child>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="menuitem2">
<property name="visible">True</property>
<property name="label" translatable="yes">_Edit</property>
<property name="use_underline">True</property>
<child>
<widget class="GtkMenu" id="menu2">
<child>
<widget class="GtkImageMenuItem" id="cut1">
<property name="visible">True</property>
<property name="label">gtk-cut</property>
<property name="use_stock">True</property>
<signal name="activate" handler="on_cut1_activate"
last_modification_time="Tue, 15 May 2007 12:34:54 GMT"/>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="copy1">
<property name="visible">True</property>
<property name="label">gtk-copy</property>
<property name="use_stock">True</property>
<signal name="activate"
handler="on_copy1_activate" last_modification_time="Tue, 15 May 2007
12:34:54 GMT"/>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="paste1">
<property name="visible">True</property>
<property name="label">gtk-paste</property>
<property name="use_stock">True</property>
<signal name="activate"
handler="on_paste1_activate" last_modification_time="Tue, 15 May 2007
12:34:54 GMT"/>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="delete1">
<property name="visible">True</property>
<property name="label">gtk-delete</property>
<property name="use_stock">True</property>
<signal name="activate"
handler="on_delete1_activate" last_modification_time="Tue, 15 May 2007
12:34:54 GMT"/>
</widget>
</child>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="menuitem3">
<property name="visible">True</property>
<property name="label" translatable="yes">_View</property>
<property name="use_underline">True</property>
<child>
<widget class="GtkMenu" id="menu3">
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="menuitem4">
<property name="visible">True</property>
<property name="label" translatable="yes">_Help</property>
<property name="use_underline">True</property>
<child>
<widget class="GtkMenu" id="menu4">
<child>
<widget class="GtkMenuItem" id="about1">
<property name="visible">True</property>
<property name="label"
translatable="yes">_About</property>
<property name="use_underline">True</property>
<signal name="activate"
handler="on_about1_activate" last_modification_time="Tue, 15 May 2007
12:34:54 GMT"/>
</widget>
</child>
</widget>
</child>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="hbox1">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkScrolledWindow" id="scrolledwindow_graph">
<property name="border_width">5</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property
name="hscrollbar_policy">GTK_POLICY_ALWAYS</property>
<property
name="vscrollbar_policy">GTK_POLICY_ALWAYS</property>
<property name="shadow_type">GTK_SHADOW_NONE</property>
<property
name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
<widget class="GtkViewport" id="viewport1">
<property name="visible">True</property>
<property name="shadow_type">GTK_SHADOW_IN</property>
<child>
<widget class="GtkCurve" id="curve1">
<property name="visible">True</property>
<property name="min_x">0</property>
<property name="max_x">1</property>
<property name="min_y">0</property>
<property name="max_y">1</property>
</widget>
</child>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkVBox" id="vbox_max_min">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkFrame" id="frame_volt">
<property name="border_width">5</property>
<property name="width_request">45</property>
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="label_yalign">0.5</property>
<property
name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
<child>
<widget class="GtkAlignment" id="alignment1">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xscale">1</property>
<property name="yscale">1</property>
<property name="top_padding">0</property>
<property name="bottom_padding">0</property>
<property name="left_padding">12</property>
<property name="right_padding">0</property>
<child>
<widget class="GtkVBox" id="vbox3">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkTable" id="table1">
<property name="visible">True</property>
<property name="n_rows">2</property>
<property name="n_columns">2</property>
<property
name="homogeneous">False</property>
<property name="row_spacing">0</property>
<property
name="column_spacing">10</property>
<child>
<widget class="GtkLabel"
id="label_volt_max_n">
<property
name="visible">True</property>
<property name="label"
translatable="yes">0.0</property>
<property
name="use_underline">False</property>
<property
name="use_markup">False</property>
<property
name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property
name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property
name="left_attach">1</property>
<property
name="right_attach">2</property>
<property
name="top_attach">0</property>
<property
name="bottom_attach">1</property>
<property
name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel"
id="label_volt_max">
<property
name="visible">True</property>
<property name="label"
translatable="yes">Max:</property>
<property
name="use_underline">False</property>
<property
name="use_markup">False</property>
<property
name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property
name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property
name="left_attach">0</property>
<property
name="right_attach">1</property>
<property
name="top_attach">0</property>
<property
name="bottom_attach">1</property>
<property
name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel"
id="label_volt_min">
<property
name="visible">True</property>
<property name="label"
translatable="yes">Min:</property>
<property
name="use_underline">False</property>
<property
name="use_markup">False</property>
<property
name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property
name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property
name="left_attach">0</property>
<property
name="right_attach">1</property>
<property
name="top_attach">1</property>
<property
name="bottom_attach">2</property>
<property
name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel"
id="label_volt_min_n">
<property
name="visible">True</property>
<property name="label"
translatable="yes">0.0</property>
<property
name="use_underline">False</property>
<property
name="use_markup">False</property>
<property
name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property
name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property
name="left_attach">1</property>
<property
name="right_attach">2</property>
<property
name="top_attach">1</property>
<property
name="bottom_attach">2</property>
<property
name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="label"
translatable="yes"><b>Votage</b></property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property
name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="type">label_item</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkFrame" id="frame_cur">
<property name="border_width">5</property>
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="label_yalign">0.5</property>
<property
name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
<child>
<widget class="GtkAlignment" id="alignment2">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xscale">1</property>
<property name="yscale">1</property>
<property name="top_padding">0</property>
<property name="bottom_padding">0</property>
<property name="left_padding">12</property>
<property name="right_padding">0</property>
<child>
<widget class="GtkVBox" id="vbox4">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkTable" id="table2">
<property name="visible">True</property>
<property name="n_rows">2</property>
<property name="n_columns">2</property>
<property
name="homogeneous">False</property>
<property name="row_spacing">0</property>
<property
name="column_spacing">10</property>
<child>
<widget class="GtkLabel"
id="label_cur_max">
<property
name="visible">True</property>
<property name="label"
translatable="yes">Max:</property>
<property
name="use_underline">False</property>
<property
name="use_markup">False</property>
<property
name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property
name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property
name="left_attach">0</property>
<property
name="right_attach">1</property>
<property
name="top_attach">0</property>
<property
name="bottom_attach">1</property>
<property
name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel"
id="label_cur_min">
<property
name="visible">True</property>
<property name="label"
translatable="yes">Min:</property>
<property
name="use_underline">False</property>
<property
name="use_markup">False</property>
<property
name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property
name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property
name="left_attach">0</property>
<property
name="right_attach">1</property>
<property
name="top_attach">1</property>
<property
name="bottom_attach">2</property>
<property
name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel"
id="label_cur_min_n">
<property
name="visible">True</property>
<property name="label"
translatable="yes">0.0</property>
<property
name="use_underline">False</property>
<property
name="use_markup">False</property>
<property
name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property
name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property
name="left_attach">1</property>
<property
name="right_attach">2</property>
<property
name="top_attach">1</property>
<property
name="bottom_attach">2</property>
<property
name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel"
id="label_cur_max_n">
<property
name="visible">True</property>
<property name="label"
translatable="yes">0.0</property>
<property
name="use_underline">False</property>
<property
name="use_markup">False</property>
<property
name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property
name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property
name="left_attach">1</property>
<property
name="right_attach">2</property>
<property
name="top_attach">0</property>
<property
name="bottom_attach">1</property>
<property
name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="label"
translatable="yes"><b>Current</b></property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property
name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="type">label_item</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkHButtonBox" id="hbuttonbox1">
<property name="visible">True</property>
<property
name="layout_style">GTK_BUTTONBOX_DEFAULT_STYLE</property>
<property name="spacing">0</property>
<child>
<widget class="GtkButton" id="button_start">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label"
translatable="yes">Start</property>
<property name="use_underline">True</property>
<property
name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<signal name="clicked"
handler="on_button_start_clicked" last_modification_time="Wed, 16 May
2007 17:21:23 GMT"/>
</widget>
</child>
<child>
<widget class="GtkButton" id="button_stop">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label"
translatable="yes">Stop</property>
<property name="use_underline">True</property>
<property
name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkStatusbar" id="statusbar1">
<property name="visible">True</property>
<property name="has_resize_grip">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
</child>
</widget>
<widget class="GtkWindow" id="about">
<property name="visible">True</property>
<property name="title" translatable="yes">window2</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">False</property>
<property name="decorated">True</property>
<property name="skip_taskbar_hint">False</property>
<property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<child>
<widget class="GtkVBox" id="vbox6">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label_about">
<property name="visible">True</property>
<property name="label" translatable="yes">(C) 2007 Daniel
Dieterle</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkHButtonBox" id="hbuttonbox2">
<property name="visible">True</property>
<property
name="layout_style">GTK_BUTTONBOX_DEFAULT_STYLE</property>
<property name="spacing">0</property>
<child>
<widget class="GtkButton" id="button1">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label"
translatable="yes">button1</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
</widget>
</child>
<child>
<widget class="GtkButton" id="button2">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label"
translatable="yes">button2</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface>
I already searched the internet and the mailinglist. It seems, that i'm
not the onliest one with this problem. But i didn't found any solution.
Thanks in advance.
Daniel D.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]