]> gitweb.michael.orlitzky.com - xfce4-hdaps.git/commitdiff
xfce4-hdaps-dialogs.c: update to newer combo box API.
authorMichael Orlitzky <michael@orlitzky.com>
Wed, 23 Oct 2019 02:59:40 +0000 (22:59 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Sat, 26 Oct 2019 14:29:52 +0000 (10:29 -0400)
The gtk_combo_box_get_active_text() and gtk_combo_box_append_text()
functions have apparently been deprecated since gtk+-2.24. Instead
of calling those functions on a GtkComboBox pointer, we're instead
supposed to call e.g. gtk_combo_box_text_get_active_text() on a
GtkComboBoxText pointer.

Since our "cb_device_name" member was only ever declared as a GtkWidget,
all we have to do is switch everything to the new functions so that they
create, access, and modify the GtkComboBoxText referred to by cb_device_name
instead of a GtkComboBox in the same place.

panel-plugin/xfce4-hdaps-dialogs.c

index b6da7cb95edab9e365a81dc0f243906c0ddbeba3..78fecdb8c4ede9a85610873d3999ac2717af8e8c 100644 (file)
@@ -62,7 +62,7 @@ static void hdaps_configure_response(GtkWidget   *dialog,
        want to save any settings that may have changed. */
     g_object_set_data(G_OBJECT(hdaps->plugin), "dialog", NULL);
     hdaps->poll_frequency = gtk_spin_button_get_value_as_int((GtkSpinButton*)hdaps->sb_poll_frequency);
        want to save any settings that may have changed. */
     g_object_set_data(G_OBJECT(hdaps->plugin), "dialog", NULL);
     hdaps->poll_frequency = gtk_spin_button_get_value_as_int((GtkSpinButton*)hdaps->sb_poll_frequency);
-    hdaps->device_name = gtk_combo_box_get_active_text((GtkComboBox*)hdaps->cb_device_name);
+    hdaps->device_name = gtk_combo_box_text_get_active_text((GtkComboBoxText*)hdaps->cb_device_name);
     snprintf(hdaps->sysfs_file, FILENAME_MAX, UNLOAD_HEADS_FMT, hdaps->device_name);
     hdaps_save(hdaps->plugin, hdaps);
     hdaps_reset_timeout(hdaps);
     snprintf(hdaps->sysfs_file, FILENAME_MAX, UNLOAD_HEADS_FMT, hdaps->device_name);
     hdaps_save(hdaps->plugin, hdaps);
     hdaps_reset_timeout(hdaps);
@@ -155,11 +155,11 @@ void hdaps_configure(XfcePanelPlugin *plugin,
   gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
   gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
 
   gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
   gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
 
-  hdaps->cb_device_name = gtk_combo_box_new_text();
+  hdaps->cb_device_name = gtk_combo_box_text_new();
 
   /* Add the current device name, it should always be available.
      Oh, and it should be the default, too. */
 
   /* Add the current device name, it should always be available.
      Oh, and it should be the default, too. */
-  gtk_combo_box_append_text((GtkComboBox*)hdaps->cb_device_name, hdaps->device_name);
+  gtk_combo_box_text_append_text((GtkComboBoxText*)hdaps->cb_device_name, hdaps->device_name);
   
   /* This function takes an index, and 0 should be the first
      (only) index at this point. */
   
   /* This function takes an index, and 0 should be the first
      (only) index at this point. */
@@ -177,7 +177,7 @@ void hdaps_configure(XfcePanelPlugin *plugin,
        the only entry. Therefore, to avoid duplicates, we only
        have to avoid adding the current device name a second time. */
     if (strcmp(hdaps_devices[list_idx], hdaps->device_name) != 0) {
        the only entry. Therefore, to avoid duplicates, we only
        have to avoid adding the current device name a second time. */
     if (strcmp(hdaps_devices[list_idx], hdaps->device_name) != 0) {
-      gtk_combo_box_append_text((GtkComboBox*)hdaps->cb_device_name, hdaps_devices[list_idx]);
+      gtk_combo_box_text_append_text((GtkComboBoxText*)hdaps->cb_device_name, hdaps_devices[list_idx]);
     }
   }
   
     }
   }