From 7e4869045b4327cbd8453e7a9b670680f8cfb87d Mon Sep 17 00:00:00 2001 From: info-cppsp Date: Wed, 17 Jan 2018 15:46:11 +0100 Subject: fix GtkStock deprecations --- sensors-applet/prefs-dialog.c | 14 +++++++++----- sensors-applet/sensor-config-dialog.c | 17 ++++++++++------- sensors-applet/sensors-applet.c | 6 +++--- 3 files changed, 22 insertions(+), 15 deletions(-) diff --git a/sensors-applet/prefs-dialog.c b/sensors-applet/prefs-dialog.c index 6694ada..e477dba 100644 --- a/sensors-applet/prefs-dialog.c +++ b/sensors-applet/prefs-dialog.c @@ -417,12 +417,13 @@ void prefs_dialog_open(SensorsApplet *sensors_applet) { prefs_dialog->dialog = GTK_DIALOG(gtk_dialog_new_with_buttons(_("Sensors Applet Preferences"), NULL, 0, - GTK_STOCK_HELP, + "gtk-help", GTK_RESPONSE_HELP, - GTK_STOCK_CLOSE, + "gtk-close", GTK_RESPONSE_CLOSE, NULL)); + gtk_window_set_icon_name(GTK_WINDOW(prefs_dialog->dialog), "mate-sensors-applet"); g_object_set(prefs_dialog->dialog, @@ -822,14 +823,16 @@ void prefs_dialog_open(SensorsApplet *sensors_applet) { /* when selection is changed, make sure sensor_config button is activated */ /* Create buttons for user to interact with sensors tree */ - prefs_dialog->sensor_up_button = GTK_BUTTON(gtk_button_new_from_stock(GTK_STOCK_GO_UP)); + prefs_dialog->sensor_up_button = GTK_BUTTON(gtk_button_new_with_mnemonic(_("_Up"))); + gtk_button_set_image(prefs_dialog->sensor_up_button, gtk_image_new_from_icon_name("go-up", GTK_ICON_SIZE_BUTTON)); gtk_widget_set_sensitive(GTK_WIDGET(prefs_dialog->sensor_up_button), FALSE); g_signal_connect(prefs_dialog->sensor_up_button, "clicked", G_CALLBACK(prefs_dialog_sensor_up_button_clicked), prefs_dialog); - prefs_dialog->sensor_down_button = GTK_BUTTON(gtk_button_new_from_stock(GTK_STOCK_GO_DOWN)); + prefs_dialog->sensor_down_button = GTK_BUTTON(gtk_button_new_with_mnemonic(_("_Down"))); + gtk_button_set_image(prefs_dialog->sensor_down_button, gtk_image_new_from_icon_name("go-down", GTK_ICON_SIZE_BUTTON)); gtk_widget_set_sensitive(GTK_WIDGET(prefs_dialog->sensor_down_button), FALSE); g_signal_connect(prefs_dialog->sensor_down_button, "clicked", @@ -862,7 +865,8 @@ void prefs_dialog_open(SensorsApplet *sensors_applet) { /* Sensor Config button */ /* initially make button insensitive until user selects a row from the sensors tree */ - prefs_dialog->sensor_config_button = GTK_BUTTON(gtk_button_new_from_stock(GTK_STOCK_PROPERTIES)); + prefs_dialog->sensor_config_button = GTK_BUTTON(gtk_button_new_with_mnemonic(_("_Properties"))); + gtk_button_set_image(prefs_dialog->sensor_config_button, gtk_image_new_from_icon_name("document-properties", GTK_ICON_SIZE_BUTTON)); g_object_set(prefs_dialog->sensor_config_button, "sensitive", FALSE, NULL); diff --git a/sensors-applet/sensor-config-dialog.c b/sensors-applet/sensor-config-dialog.c index ba095d1..3d3150b 100644 --- a/sensors-applet/sensor-config-dialog.c +++ b/sensors-applet/sensor-config-dialog.c @@ -30,7 +30,7 @@ typedef struct { SensorsApplet *sensors_applet; - GtkWidget *dialog; + GtkDialog *dialog; /* icon widgets */ GtkLabel *icon_header, *icon_type_label; GtkComboBox *icon_type_combo_box; @@ -387,14 +387,17 @@ void sensor_config_dialog_create(SensorsApplet *sensors_applet) { -1); header_text = g_strdup_printf("%s - %s", _("Sensor Properties"), sensor_label); - config_dialog->dialog = gtk_dialog_new_with_buttons(header_text, + + config_dialog->dialog = GTK_DIALOG(gtk_dialog_new_with_buttons(header_text, GTK_WINDOW(sensors_applet->prefs_dialog->dialog), GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_STOCK_HELP, + "gtk-help", GTK_RESPONSE_HELP, - GTK_STOCK_CLOSE, + "gtk-close", GTK_RESPONSE_CLOSE, - NULL); + NULL)); + + gtk_window_set_icon_name(GTK_WINDOW(config_dialog->dialog), "sensors-applet"); g_free(header_text); @@ -823,8 +826,8 @@ void sensor_config_dialog_create(SensorsApplet *sensors_applet) { GTK_WIDGET(config_dialog->graph_color_button), 2, 14, 1, 1); - content_area = gtk_dialog_get_content_area (GTK_DIALOG(config_dialog->dialog)); + content_area = gtk_dialog_get_content_area (config_dialog->dialog); gtk_box_pack_start(GTK_BOX(content_area), GTK_WIDGET(config_dialog->grid), FALSE, FALSE, 0); - gtk_widget_show_all(config_dialog->dialog); + gtk_widget_show_all(GTK_WIDGET(config_dialog->dialog)); } diff --git a/sensors-applet/sensors-applet.c b/sensors-applet/sensors-applet.c index 583c42c..b85d1bf 100644 --- a/sensors-applet/sensors-applet.c +++ b/sensors-applet/sensors-applet.c @@ -231,13 +231,13 @@ static gboolean mouse_leave_cb(GtkWidget *widget, GdkEventCrossing *event, gpoin } static const GtkActionEntry sensors_applet_menu_actions[] = { - { "Preferences", GTK_STOCK_PROPERTIES, N_("_Preferences"), + { "Preferences", "document-properties", N_("_Preferences"), NULL, NULL, G_CALLBACK(prefs_cb) }, - { "Help", GTK_STOCK_HELP, N_("_Help"), + { "Help", "help-browser", N_("_Help"), NULL, NULL, G_CALLBACK(help_cb) }, - { "About", GTK_STOCK_ABOUT, N_("_About"), + { "About", "help-about", N_("_About"), NULL, NULL, G_CALLBACK(about_cb) } }; -- cgit v1.2.1