Replace deprecated widgets in goffice

This commit is contained in:
Robert Fewell 2017-06-16 16:51:37 +01:00
parent d29bb5b8cd
commit 090968f1f2
2 changed files with 12 additions and 10 deletions

View File

@ -255,7 +255,7 @@ static GHashTable *encoding_hash;
struct _GOCharmapSel struct _GOCharmapSel
{ {
GtkHBox box; GtkBox box;
GOOptionMenu *encodings; GOOptionMenu *encodings;
GtkMenu *encodings_menu; GtkMenu *encodings_menu;
GOCharmapSelTestDirection test; GOCharmapSelTestDirection test;
@ -263,7 +263,7 @@ struct _GOCharmapSel
typedef struct typedef struct
{ {
GtkHBoxClass parent_class; GtkBoxClass parent_class;
gboolean (*charmap_changed)(GOCharmapSel *cs, char const *new_charmap); gboolean (*charmap_changed)(GOCharmapSel *cs, char const *new_charmap);
} GOCharmapSelClass; } GOCharmapSelClass;
@ -361,6 +361,8 @@ static void cs_emphasize_label(GtkLabel *label)
static void cs_init(GOCharmapSel *cs) static void cs_init(GOCharmapSel *cs)
{ {
gtk_orientable_set_orientation (GTK_ORIENTABLE(cs), GTK_ORIENTATION_HORIZONTAL);
cs->test = GO_CHARMAP_SEL_TO_UTF8; cs->test = GO_CHARMAP_SEL_TO_UTF8;
cs->encodings = GO_OPTION_MENU(go_option_menu_new()); cs->encodings = GO_OPTION_MENU(go_option_menu_new());
@ -604,7 +606,7 @@ go_charmap_sel_get_type (void)
(GInstanceInitFunc) cs_init (GInstanceInitFunc) cs_init
}; };
go_charmap_sel_type = g_type_register_static (GTK_TYPE_HBOX, go_charmap_sel_type = g_type_register_static (GTK_TYPE_BOX,
"GOCharmapSel", "GOCharmapSel",
&go_charmap_sel_info, 0); &go_charmap_sel_info, 0);
} }

View File

@ -121,7 +121,7 @@ static void go_option_menu_position(GtkMenu *menu, gint *x, gint *y,
widget = GTK_WIDGET(option_menu); widget = GTK_WIDGET(option_menu);
gtk_widget_get_child_requisition(GTK_WIDGET(menu), &requisition); gtk_widget_get_preferred_size(GTK_WIDGET(menu), &requisition, NULL);
menu_width = requisition.width; menu_width = requisition.width;
gdk_window_get_origin(gtk_widget_get_window(widget), &menu_xpos, gdk_window_get_origin(gtk_widget_get_window(widget), &menu_xpos,
@ -139,14 +139,14 @@ static void go_option_menu_position(GtkMenu *menu, gint *x, gint *y,
if (GTK_IS_CHECK_MENU_ITEM(child) if (GTK_IS_CHECK_MENU_ITEM(child)
&& gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(child))) && gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(child)))
{ {
gtk_widget_get_child_requisition(child, &requisition); gtk_widget_get_preferred_size(child, &requisition, NULL);
menu_ypos -= requisition.height / 2; menu_ypos -= requisition.height / 2;
break; break;
} }
if (gtk_widget_get_visible(child)) if (gtk_widget_get_visible(child))
{ {
gtk_widget_get_child_requisition(child, &requisition); gtk_widget_get_preferred_size(child, &requisition, NULL);
menu_ypos -= requisition.height; menu_ypos -= requisition.height;
} }
@ -402,20 +402,20 @@ static void go_option_menu_init(GOOptionMenu *option_menu)
gtk_widget_set_can_default(GTK_WIDGET(option_menu), FALSE); gtk_widget_set_can_default(GTK_WIDGET(option_menu), FALSE);
gtk_widget_set_receives_default(GTK_WIDGET(option_menu), FALSE); gtk_widget_set_receives_default(GTK_WIDGET(option_menu), FALSE);
box = GTK_BOX(gtk_hbox_new(FALSE, FALSE)); box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_box_set_homogeneous (GTK_BOX (box), FALSE);
option_menu->menu = NULL; option_menu->menu = NULL;
option_menu->selected = NULL; option_menu->selected = NULL;
option_menu->button_label = GTK_LABEL(gtk_label_new("")); option_menu->button_label = GTK_LABEL(gtk_label_new(""));
gtk_box_pack_start(box, GTK_WIDGET(option_menu->button_label), FALSE, TRUE, gtk_box_pack_start(box, GTK_WIDGET(option_menu->button_label), FALSE, TRUE, 0);
0);
arrow = gtk_arrow_new(GTK_ARROW_DOWN, GTK_SHADOW_NONE); arrow = gtk_arrow_new(GTK_ARROW_DOWN, GTK_SHADOW_NONE);
g_object_set(arrow, "xalign", 0.75, NULL); g_object_set(arrow, "xalign", 0.75, NULL);
gtk_box_pack_end(box, arrow, FALSE, FALSE, 0); gtk_box_pack_end(box, arrow, FALSE, FALSE, 0);
sep = gtk_vseparator_new(); sep = gtk_separator_new (GTK_ORIENTATION_VERTICAL);
gtk_box_pack_end(box, sep, FALSE, FALSE, 0); gtk_box_pack_end(box, sep, FALSE, FALSE, 0);
gtk_container_add(GTK_CONTAINER(option_menu), GTK_WIDGET(box)); gtk_container_add(GTK_CONTAINER(option_menu), GTK_WIDGET(box));