bryangrim / darkice

Automatically exported from code.google.com/p/darkice
0 stars 0 forks source link

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

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
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 instance `0x1d5b9b0'

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: "));

Original issue reported on code.google.com by oetelaar.automatisering on 7 May 2013 at 10:30

GoogleCodeExporter commented 8 years ago
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' 
to `GtkCombo'

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

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

Because the cast fails.

Original comment by oetelaar.automatisering on 7 May 2013 at 10:37

GoogleCodeExporter commented 8 years ago
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.

Original comment by oetelaar.automatisering on 7 May 2013 at 10:59

GoogleCodeExporter commented 8 years ago
All fixed in r513.
Thanks for the patches! 

Original comment by rafael2k...@gmail.com on 14 May 2013 at 2:54