Export to GitHub

darkice - issue #86

GTK problems with darksnow + possible Fix suggestion (signal name `depressed' is invalid for instance)


Posted on May 7, 2013 by Massive Bird

What steps will reproduce the problem? 1. start darksnow 2. click on combo box 3. see the error messages in the console

What is the expected output? What do you see instead? Expect no messages, this is because of use of deprecated GTK functions

(darksnow:1496): GLib-GObject-WARNING **: /build/buildd/glib2.0-2.24.1/gobject/gsignal.c:3079: signal name depressed' is invalid for instance0x1d5b9b0'

The fix is not very hard. The ComboBox widgets work differently now. I made a small test and patch it here. (for just one combo_box) gtk_combo_new() is deprecated and should be gtk_combo_box_entry_new_text() The items are not added using a linked list but a TreeModel, or one by one.

Index: darksnow.c

--- darksnow.c (revision 510) +++ darksnow.c (working copy) @@ -230,14 +230,11 @@

/* Server Options Widgets */ label_icecast = gtk_label_new ( gettext("Streaming Destination: ")); - combo_icecast = gtk_combo_new (); - glist_icecast = NULL; - glist_icecast = g_list_append (glist_icecast, "Icecast 1"); - glist_icecast = g_list_append (glist_icecast, "Icecast 2"); - glist_icecast = g_list_append (glist_icecast, "Shoutcast"); - gtk_combo_set_popdown_strings (GTK_COMBO (combo_icecast), glist_icecast);

- gtk_entry_set_text ( GTK_ENTRY(GTK_COMBO(combo_icecast)->entry), "Icecast 2");

  • combo_icecast = gtk_combo_box_entry_new_text();
  • const gchar *txt[] = {"Icecast 1", "Icecast 2", "Shoutcast", NULL };
  • const gchar **p=txt;
  • while (*p) gtk_combo_box_append_text(GTK_COMBO_BOX(combo_icecast), *p++);
  • label_server = gtk_label_new ( gettext("Server: ")); entry_server = gtk_entry_new (); label_port = gtk_label_new ( gettext("Port: "));

Comment #1

Posted on May 7, 2013 by Massive Bird

When trying to get the data from the combobox stuff works different too. Have not checked that, but get error message like this : (darksnow:2744): GLib-GObject-WARNING **: invalid cast from GtkComboBoxEntry' toGtkCombo'

(darksnow:2744): GLib-GObject-WARNING **: invalid uninstantiatable type (null)' in cast toGtkEntry'

(darksnow:2744): Gtk-CRITICAL **: gtk_entry_get_text: assertion `GTK_IS_ENTRY (entry)' failed

Because the cast fails.

Comment #2

Posted on May 7, 2013 by Massive Bird

The config file was not written correctly with the new combo box. This is fixed by this patch:

Index: config_files.c

--- config_files.c (revision 510) +++ config_files.c (working copy) @@ -84,7 +84,7 @@ adddate = (char) (gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON (checkbutton_adddate) ))? '1': '0';

/* Combo box inputs */ - icecast = (char *) gtk_entry_get_text ( GTK_ENTRY( GTK_COMBO(combo_icecast)->entry)); + icecast = (char *) gtk_combo_box_get_active_text(GTK_COMBO_BOX(combo_icecast)); format = (char *) gtk_entry_get_text ( GTK_ENTRY(GTK_COMBO (combo_format)->entry )); bitrate = (char *) gtk_entry_get_text ( GTK_ENTRY(GTK_COMBO(combo_bitrate)->entry)); bitratemode = (char *) gtk_entry_get_text ( GTK_ENTRY(GTK_COMBO(combo_bitratemode)->entry));

One problem remains, reading back the config file does not set or create the correct entry in the combobox. That is a different problem, maybe someone else can take a look.

Comment #3

Posted on May 14, 2013 by Happy Lion

All fixed in r513. Thanks for the patches!

Status: Fixed

Labels:
Type-Defect Priority-Medium