After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 553182 - libglade doesn't know GtkFileChooserWidget
libglade doesn't know GtkFileChooserWidget
Status: RESOLVED WONTFIX
Product: libglade
Classification: Deprecated
Component: gtk
CVS HEAD
Other All
: Normal normal
: ---
Assigned To: James Henstridge
James Henstridge
Depends on:
Blocks:
 
 
Reported: 2008-09-21 22:18 UTC by Mackram
Modified: 2011-07-19 23:09 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
The glade file containing the glade representation of the test case (5.05 KB, application/xml)
2008-09-21 22:19 UTC, Mackram
Details
The C test file for reproducing the issue (851 bytes, text/plain)
2008-09-21 22:20 UTC, Mackram
Details
The test without the use of glade (908 bytes, text/plain)
2008-09-22 19:39 UTC, Mackram
Details

Description Mackram 2008-09-21 22:18:10 UTC
Please describe the problem:
I have been unable to show the GtkFileChooserWidget in the Win32 environment. When attempting to show the widget in say a dialog all other components of the dialog would appear except the FileChooser Widget. I have used the program with the GTK version 2.14 with libglade2.0. Also I have tested the 2.12.9 dev enviroment that comes with glade with the same issue. PS the system works fine on X11. PS I expect this to be a configuration issue but could not find it documented anywhere. Appreciate any help possible.

Steps to reproduce:
Best way to reporduce the issue is to use the program in the end of the report
1. Save the xml as C:\test.glade  
2. Compile the test.c code (I use Msys 1.0)
3. Run the output and click on the buttons.


Actual results:
If you click the first button you will see a dialog containing only two buttons. If you click the second button nothing will happen.

Expected results:
If you click the first button you should see a dialog containing the File Chooser and two buttons.
If you click the second button you should see the GtkFileChooserDialog

Does this happen every time?
Yes

Other information:
***************************Test.glade****************************
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
<!--Generated with glade3 3.4.3 on Sun Sep 21 23:22:54 2008 -->
<glade-interface>
  <widget class="GtkWindow" id="window1">
    <property name="visible">True</property>
    <child>
      <widget class="GtkHBox" id="hbox1">
        <property name="visible">True</property>
        <child>
          <widget class="GtkButton" id="button1">
            <property name="visible">True</property>
            <property name="can_focus">True</property>
            <property name="receives_default">True</property>
            <property name="label" translatable="yes">test 1 normal dialog with
file chooser widget</property>
            <property name="response_id">0</property>
            <signal name="clicked" handler="on_test1_clicked"/>
          </widget>
        </child>
        <child>
          <widget class="GtkVSeparator" id="vseparator1">
            <property name="visible">True</property>
          </widget>
          <packing>
            <property name="expand">False</property>
            <property name="position">1</property>
          </packing>
        </child>
        <child>
          <widget class="GtkButton" id="button4">
            <property name="visible">True</property>
            <property name="can_focus">True</property>
            <property name="receives_default">True</property>
            <property name="label" translatable="yes">test 2 fileChooserDialog</property>
            <property name="response_id">0</property>
            <signal name="clicked" handler="on_button2_clicked"/>
          </widget>
          <packing>
            <property name="position">2</property>
          </packing>
        </child>
      </widget>
    </child>
  </widget>
  <widget class="GtkDialog" id="file_chooser_dialog">
    <property name="border_width">5</property>
    <property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
    <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
    <property name="has_separator">False</property>
    <child internal-child="vbox">
      <widget class="GtkVBox" id="dialog-vbox1">
        <property name="visible">True</property>
        <property name="spacing">2</property>
        <child>
          <widget class="GtkFileChooserWidget" id="filechooserwidget1">
            <property name="visible">True</property>
          </widget>
          <packing>
            <property name="position">1</property>
          </packing>
        </child>
        <child internal-child="action_area">
          <widget class="GtkHButtonBox" id="dialog-action_area1">
            <property name="visible">True</property>
            <property name="layout_style">GTK_BUTTONBOX_END</property>
            <child>
              <widget class="GtkButton" id="button2">
                <property name="visible">True</property>
                <property name="can_focus">True</property>
                <property name="receives_default">True</property>
                <property name="label" translatable="yes">button</property>
                <property name="response_id">0</property>
              </widget>
            </child>
            <child>
              <widget class="GtkButton" id="button3">
                <property name="visible">True</property>
                <property name="can_focus">True</property>
                <property name="receives_default">True</property>
                <property name="label" translatable="yes">button</property>
                <property name="response_id">0</property>
              </widget>
              <packing>
                <property name="position">1</property>
              </packing>
            </child>
          </widget>
          <packing>
            <property name="expand">False</property>
            <property name="pack_type">GTK_PACK_END</property>
          </packing>
        </child>
      </widget>
    </child>
  </widget>
  <widget class="GtkFileChooserDialog" id="filechooserdialog1">
    <property name="border_width">5</property>
    <property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
    <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
    <property name="has_separator">False</property>
    <child internal-child="vbox">
      <widget class="GtkVBox" id="dialog-vbox2">
        <property name="visible">True</property>
        <property name="spacing">2</property>
        <child>
          <placeholder/>
        </child>
        <child internal-child="action_area">
          <widget class="GtkHButtonBox" id="dialog-action_area2">
            <property name="visible">True</property>
            <property name="layout_style">GTK_BUTTONBOX_END</property>
            <child>
              <placeholder/>
            </child>
            <child>
              <placeholder/>
            </child>
          </widget>
          <packing>
            <property name="expand">False</property>
            <property name="pack_type">GTK_PACK_END</property>
          </packing>
        </child>
      </widget>
    </child>
  </widget>
</glade-interface>

*****************************************************************

***************************test.c********************************
#include <gtk/gtk.h>
#include <glade/glade.h>
#ifdef WIN32
#include <windows.h>
#endif

void open_widget(GtkWidget *callingWidget, 
			gpointer user_data)
{
  GtkWidget *widget;
  widget = (GtkWidget*) user_data; 
  gtk_widget_show(widget);
  return;
}

int main(int   argc,
    char *argv[])
{
	char *fileName ="C:\\test.glade"; //this needs to be changed if you use linux
	
	GladeXML *xml;
	gtk_init(NULL,NULL);
	xml = glade_xml_new(fileName,NULL,NULL); 
	
	GtkWidget *fileChooserDialog = glade_xml_get_widget(xml,"file_chooser_dialog");
	GtkWidget *fileChooserDialog2 = glade_xml_get_widget(xml,"filechooserdialog1");
	
	glade_xml_signal_connect_data(xml,"on_test1_clicked",G_CALLBACK (open_widget), fileChooserDialog);
	glade_xml_signal_connect_data(xml,"on_test2_clicked",G_CALLBACK (open_widget), fileChooserDialog2);
	
	gtk_main();
	return 1;
}
*****************************************************************
Comment 1 Mackram 2008-09-21 22:19:54 UTC
Created attachment 119134 [details]
The glade file containing the glade representation of the test case
Comment 2 Mackram 2008-09-21 22:20:52 UTC
Created attachment 119136 [details]
The C test file for reproducing the issue
Comment 3 Cody Russell 2008-09-21 23:11:33 UTC
Is there any way I can convince you to rewrite the test program purely in C, without using libglade?  That would make it easier to test.
Comment 4 Mackram 2008-09-21 23:17:03 UTC
I had originally found the issue in my program that used libglade and hence I modeled the test around it. But if it would help in finding the problem if we took out libglade from the equation then no problem with me. I will have it done tomorrow and uploaded. PS if anyone wants more info let me know.
Comment 5 Tor Lillqvist 2008-09-21 23:55:37 UTC
When I run the program, it prints:

(553182.exe:4600): libglade-WARNING **: unknown widget class 'GtkFileChooserWidget'

This presumably is significant.

Looking in libglade sources, I see in glade-gtk.c that it registers a lot of gtk widget types. Not GTK_TYPE_FILE_CHOOSER_WIDGET though. There is code like this in libglade:

...
glade_register_widget (GTK_TYPE_EXPANDER, glade_standard_build_widget,
                       expander_build_children, NULL);
glade_register_widget (GTK_TYPE_FILE_CHOOSER, glade_standard_build_widget,
                       NULL, NULL);
glade_register_widget (GTK_TYPE_FILE_CHOOSER_DIALOG, glade_standard_build_widget,
                       gtk_dialog_build_children, dialog_find_internal_child);
glade_register_widget (GTK_TYPE_FILE_CHOOSER_BUTTON, glade_standard_build_widget,
                       NULL, NULL);
glade_register_widget (GTK_TYPE_FILE_SELECTION, NULL,
                       glade_standard_build_children, filesel_find_internal_child);
glade_register_widget (GTK_TYPE_FIXED, glade_standard_build_widget,
                       glade_standard_build_children, NULL);
...

Nothing for GTK_TYPE_FILE_CHOOSER_WIDGET.

On what Linux distro (or proprietary Unix variant) did you try? Could it be that the vendor in question has patched their libglade to know of also GTK_TYPE_FILE_CHOOSER_WIDGET?

Comment 6 Tor Lillqvist 2008-09-22 06:44:12 UTC
By the way, the program works exactly the same way on a current Linux distro as on Windows for me... I get the same warning 

unknown widget class 'GtkFileChooserWidget'

when I run it on openSUSE11 with gtk2-2.12.9-37.1 and libglade2-2.6.2-93.1.
Comment 7 Mackram 2008-09-22 18:16:27 UTC
Hey everyone,

First of thanks for all the quick comments. I am using Ubuntu (hardy) with libglade 2.6.2. Thanks for Tor I reworked on the example and found out that when compiled as a executable in Linux I also get the same warning with same issue. I apologize for not noticing this earlier and mentioning it. I should note that the code works correctly if compiled as a dynamic library (tested with XChat) but not when compiled as a standalone program. 
I will work on a version of the code that does not use libglade and test it in both win32 and linux and will report back. But I think Tor's comment points to the fact that it is an issue with libglade which I am tending to agree with.

Again sorry for the inconvenience and will report the findings of a non libglade program as soon as I am done. 
Comment 8 Mackram 2008-09-22 19:38:46 UTC
Hey just wanted to let everyone know that Tor was right it is just a libglade issue. If you would like to test I have just attached a C file that does the GTKFileChooser test without the use of glade and the issue is non-existant. I will try to resolve the issue on my side (anyone can give hints on how to submit patches or resolutions :) ).

Thanks to all
Comment 9 Mackram 2008-09-22 19:39:34 UTC
Created attachment 119185 [details]
The test without the use of glade
Comment 10 Fabio Durán Verdugo 2011-07-19 23:09:15 UTC
The GNOME Release team has officially deprecated libglade in favor of GtkBuilder[1]. So it's unlikely to get further development. I am closing bugs as WONTFIX. Please feel free to reopen the bugs in future if anyone takes the responsibility for active development.

[1] http://permalink.gmane.org/gmane.comp.gnome.devel.announce/28