And some more Jindrich Makovicka patch changes for GTK3 compatibility.

This commit is contained in:
Bill Wilson 2011-08-08 15:47:58 -05:00
parent 7fee71d39f
commit 6365d18ad0
2 changed files with 15 additions and 37 deletions

View File

@ -1337,7 +1337,7 @@ replace_plugins()
mon = (GkrellmMonitor *) list->data; mon = (GkrellmMonitor *) list->data;
if (mon->privat->main_vbox && mon != gkrellm_mon_host()) if (mon->privat->main_vbox && mon != gkrellm_mon_host())
{ {
gtk_widget_ref(mon->privat->main_vbox); g_object_ref(G_OBJECT(mon->privat->main_vbox));
gtk_container_remove(GTK_CONTAINER(gkrellm_monitor_vbox()), gtk_container_remove(GTK_CONTAINER(gkrellm_monitor_vbox()),
mon->privat->main_vbox); mon->privat->main_vbox);
} }
@ -1359,7 +1359,7 @@ replace_plugins()
{ {
gtk_box_pack_start(GTK_BOX(gkrellm_monitor_vbox()), gtk_box_pack_start(GTK_BOX(gkrellm_monitor_vbox()),
mon->privat->main_vbox, FALSE, FALSE, 0); mon->privat->main_vbox, FALSE, FALSE, 0);
gtk_widget_unref(mon->privat->main_vbox); g_object_ref(G_OBJECT(mon->privat->main_vbox));
} }
} }
} }

View File

@ -1964,8 +1964,7 @@ static GtkTreeRowReference *row_reference;
static GtkTreeSelection *selection; static GtkTreeSelection *selection;
static GtkWidget *optionmenu, static GtkWidget *optionmenu;
*optionmenu_menu;
static GtkWidget *display_mode_button[2]; static GtkWidget *display_mode_button[2];
static GtkWidget *factor_spin_button, static GtkWidget *factor_spin_button,
@ -2267,19 +2266,19 @@ sensor_reset_optionmenu(Sensor *sensor)
return; return;
sr = get_referenced_sensor(); sr = get_referenced_sensor();
if (sr == sensor) if (sr == sensor)
gtk_option_menu_set_history(GTK_OPTION_MENU(optionmenu), gtk_combo_box_set_active(GTK_COMBO_BOX(optionmenu),
SENSOR_PANEL_LOCATION); SENSOR_PANEL_LOCATION);
} }
static void static void
cb_location_menu(GtkOptionMenu *om, gpointer data) cb_location_menu(GtkComboBox *om, gpointer data)
{ {
GList *list; GList *list;
Sensor *sr, *s; Sensor *sr, *s;
gchar *pname = NULL; gchar *pname = NULL;
gint location; gint location;
location = gtk_option_menu_get_history(om); location = gtk_combo_box_get_active(om);
sr = get_referenced_sensor(); sr = get_referenced_sensor();
if (!sr || !sr->enabled || sr->location == location) if (!sr || !sr->enabled || sr->location == location)
return; return;
@ -2323,7 +2322,7 @@ cb_location_menu(GtkOptionMenu *om, gpointer data)
if (sr->location != location) /* location failed */ if (sr->location != location) /* location failed */
{ {
gtk_option_menu_set_history(GTK_OPTION_MENU(optionmenu), gtk_combo_box_set_active(GTK_COMBO_BOX(optionmenu),
SENSOR_PANEL_LOCATION); SENSOR_PANEL_LOCATION);
sensor_relocation_error(pname); sensor_relocation_error(pname);
} }
@ -2333,8 +2332,6 @@ cb_location_menu(GtkOptionMenu *om, gpointer data)
static void static void
create_location_menu(gint group) create_location_menu(gint group)
{ {
GtkWidget *menu;
GtkWidget *menuitem;
gint n, n_cpus; gint n, n_cpus;
static gint sig_id; static gint sig_id;
@ -2342,42 +2339,24 @@ create_location_menu(gint group)
return; return;
sensor_last_group = group; sensor_last_group = group;
if (optionmenu_menu) gtk_combo_box_append_text(GTK_COMBO_BOX(optionmenu), "default");
{
g_signal_handler_disconnect(G_OBJECT(optionmenu), sig_id);
gtk_widget_destroy(optionmenu_menu);
}
menu = gtk_menu_new();
menuitem = gtk_menu_item_new_with_label("default");
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
gtk_widget_show(menuitem);
if (group == SENSOR_GROUP_MAINBOARD) if (group == SENSOR_GROUP_MAINBOARD)
{ {
menuitem = gtk_menu_item_new_with_label( gtk_combo_box_append_text(GTK_COMBO_BOX(optionmenu),
gkrellm_proc_get_sensor_panel_label()); gkrellm_proc_get_sensor_panel_label());
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
gtk_widget_show(menuitem);
n_cpus = gkrellm_smp_cpus() + 1; n_cpus = gkrellm_smp_cpus() + 1;
for (n = 0; n < n_cpus; ++n) for (n = 0; n < n_cpus; ++n)
{ {
menuitem = gtk_menu_item_new_with_label( gtk_combo_box_append_text(GTK_COMBO_BOX(optionmenu),
gkrellm_cpu_get_sensor_panel_label(n)); gkrellm_cpu_get_sensor_panel_label(n));
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
gtk_widget_show(menuitem);
} }
} }
else if (group == SENSOR_GROUP_DISK) else if (group == SENSOR_GROUP_DISK)
{ {
menuitem = gtk_menu_item_new_with_label(_("Disk")); gtk_combo_box_append_text(GTK_COMBO_BOX(optionmenu), _("Disk"));
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
gtk_widget_show(menuitem);
} }
gtk_option_menu_set_menu(GTK_OPTION_MENU(optionmenu), menu);
optionmenu_menu = menu;
sig_id = g_signal_connect(G_OBJECT(optionmenu), "changed", sig_id = g_signal_connect(G_OBJECT(optionmenu), "changed",
G_CALLBACK(cb_location_menu), NULL); G_CALLBACK(cb_location_menu), NULL);
} }
@ -2408,7 +2387,7 @@ set_sensor_widget_states(Sensor *s)
} }
} }
create_location_menu(s ? s->group : 0); create_location_menu(s ? s->group : 0);
gtk_option_menu_set_history(GTK_OPTION_MENU(optionmenu), location); gtk_combo_box_set_active(GTK_COMBO_BOX(optionmenu), location);
gtk_spin_button_set_value(GTK_SPIN_BUTTON(factor_spin_button), factor); gtk_spin_button_set_value(GTK_SPIN_BUTTON(factor_spin_button), factor);
gtk_spin_button_set_value(GTK_SPIN_BUTTON(offset_spin_button), offset); gtk_spin_button_set_value(GTK_SPIN_BUTTON(offset_spin_button), offset);
gtk_widget_set_sensitive(optionmenu, p_sensitive); gtk_widget_set_sensitive(optionmenu, p_sensitive);
@ -2809,8 +2788,7 @@ create_sensors_tab(GtkWidget *tab_vbox)
box = gkrellm_gtk_framed_vbox(vbox1, _("Location"), 2, FALSE, 0, 2); box = gkrellm_gtk_framed_vbox(vbox1, _("Location"), 2, FALSE, 0, 2);
optionmenu = gtk_option_menu_new(); optionmenu = gtk_combo_box_new_text();
optionmenu_menu = NULL;
gtk_box_pack_start(GTK_BOX(box), optionmenu, FALSE, FALSE, 4); gtk_box_pack_start(GTK_BOX(box), optionmenu, FALSE, FALSE, 4);