From: Hugo Villeneuve Date: Thu, 11 Dec 2014 02:27:35 +0000 (-0500) Subject: Conversion to Gtk+-3 X-Git-Url: http://gitweb.hugovil.com/?a=commitdiff_plain;h=fedff5d38cdf791eb3640aec3dec74e4f4d4c736;p=emu8051.git Conversion to Gtk+-3 --- diff --git a/configure.ac b/configure.ac index 0308b48..1222ea9 100644 --- a/configure.ac +++ b/configure.ac @@ -56,21 +56,18 @@ PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.26.0]) AC_SUBST(GLIB_CFLAGS) AC_SUBST(GLIB_LIBS) -dnl Checks for Gtk+-2.0 +dnl Checks for Gtk+-3.0 AC_ARG_ENABLE(gui, [ --enable-gui Enable building the GUI (default=yes)], [ac_cv_enable_gui=$enableval], [ac_cv_enable_gui=yes]) AC_MSG_CHECKING([whether to build GUI]) if test x$ac_cv_enable_gui = xyes; then AC_MSG_RESULT(yes) - PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.4.0, [], dnl + PKG_CHECK_MODULES(GTK, gtk+-3.0 >= 3.0, [], dnl ac_cv_enable_gui=no) if test x$ac_cv_enable_gui = xyes; then AC_DEFINE([HAVE_GTK],1,[Set to 1 to enable GTK+ support for building GUI.]) - - GTK_CFLAGS="${GTK_CFLAGS} -DGDK_PIXBUF_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED" - AC_SUBST(GTK_CFLAGS) AC_SUBST(GTK_LIBS) fi @@ -134,4 +131,5 @@ AC_OUTPUT(Makefile src/gtk/Makefile data/Makefile doc/Makefile - tests/Makefile) + tests/Makefile +) diff --git a/src/gtk/filemenu.c b/src/gtk/filemenu.c index 3c36fec..d879b67 100644 --- a/src/gtk/filemenu.c +++ b/src/gtk/filemenu.c @@ -45,7 +45,7 @@ remember_current_folder(GtkFileChooser *chooser) } static void -file_open_event(GtkObject *object, gpointer data) +file_open_event(GObject *object, gpointer data) { GtkWidget *file_dialog; char *dir; @@ -60,8 +60,8 @@ file_open_event(GtkObject *object, gpointer data) /* Create a new file selection widget. */ file_dialog = gtk_file_chooser_dialog_new( FILENAME_DESCRIPTION, NULL, GTK_FILE_CHOOSER_ACTION_OPEN, - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL); + "_Cancel", GTK_RESPONSE_CANCEL, + "_Open", GTK_RESPONSE_ACCEPT, NULL); if (strlen(previous_folder) == 0) { /* Opening file chooser to current working directory. */ diff --git a/src/gtk/main.c b/src/gtk/main.c index 4b360d2..045f32c 100644 --- a/src/gtk/main.c +++ b/src/gtk/main.c @@ -207,7 +207,7 @@ add_buttons(void) GtkWidget *button; /* The buttons of the hbox are NOT given equal space in the box. */ - button_hbox = gtk_hbox_new(FALSE, 0); + button_hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); /* Creating the RESET button. */ button = button_add_pix(button_hbox, reset_xpm); @@ -223,13 +223,13 @@ add_buttons(void) /* Creating STOP button. */ button = button_add_pix(button_hbox, stop_xpm); - g_signal_connect(GTK_OBJECT(button), "clicked", + g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(emugtk_stop_event), NULL); /* Creating STEP button. */ button = button_add_pix(button_hbox, step_xpm); - g_signal_connect(GTK_OBJECT(button), "clicked", + g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(emugtk_step_event), NULL); @@ -391,7 +391,7 @@ emugtk_create_memory_paned(void) { /* Create vpaned (memory windows) only if necessary. */ if (cfg->view_int_memory || cfg->view_ext_memory) { - vpaned1 = gtk_vpaned_new(); + vpaned1 = gtk_paned_new(GTK_ORIENTATION_VERTICAL); gtk_paned_set_position(GTK_PANED(vpaned1), cfg->vpane_pos); g_signal_connect(G_OBJECT(vpaned1), "notify::position", @@ -523,7 +523,7 @@ emugtk_window_init(void) } /* hpaned will contain registers and disassembly windows. */ - hpaned = gtk_hpaned_new(); + hpaned = gtk_paned_new(GTK_ORIENTATION_HORIZONTAL); gtk_paned_set_position(GTK_PANED(hpaned), cfg->hpane_pos); g_signal_connect(G_OBJECT(hpaned), "notify::position", G_CALLBACK(hpaned_notify_event), hpaned); @@ -542,9 +542,9 @@ emugtk_window_init(void) * group2: memory windows */ if (cfg->layout == UI_LAYOUT1) - main_paned = gtk_vpaned_new(); + main_paned = gtk_paned_new(GTK_ORIENTATION_VERTICAL); else - main_paned = gtk_hpaned_new(); + main_paned = gtk_paned_new(GTK_ORIENTATION_HORIZONTAL); gtk_paned_set_position(GTK_PANED(main_paned), cfg->main_pane_pos); g_signal_connect(G_OBJECT(main_paned), "notify::position", @@ -560,7 +560,7 @@ emugtk_window_init(void) * vbox contains the menu bar and body_vbox (for all remaining * items). */ - vbox = gtk_vbox_new(FALSE, 1); + vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 1); gtk_box_pack_start(GTK_BOX(vbox), menu_bar, FALSE, FALSE, 1); gtk_box_pack_start(GTK_BOX(vbox), buttons_bar, FALSE, FALSE, 1); gtk_box_pack_start(GTK_BOX(vbox), main_paned, true, true, 1); diff --git a/src/gtk/timerwin.c b/src/gtk/timerwin.c index 985ffd4..d478365 100644 --- a/src/gtk/timerwin.c +++ b/src/gtk/timerwin.c @@ -29,14 +29,15 @@ button_add_stock(GtkWidget *box, gchar *stock_id, int display_label) /* Create the button. */ if (display_label) { /* By default, a label is appended to stock buttons. */ - button = gtk_button_new_from_stock(stock_id); + button = gtk_button_new_from_icon_name( + stock_id, GTK_ICON_SIZE_SMALL_TOOLBAR); } else { GtkWidget *icon; button = gtk_button_new(); gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NORMAL); - icon = gtk_image_new_from_stock(stock_id, - GTK_ICON_SIZE_SMALL_TOOLBAR); + icon = gtk_image_new_from_icon_name(stock_id, + GTK_ICON_SIZE_MENU /*SMALL_TOOLBAR*/); gtk_container_add(GTK_CONTAINER(button), icon); } @@ -89,15 +90,15 @@ timerwin_init(int id) frame = gtk_frame_new(title); /* The items of the hbox are NOT given equal space in the box. */ - hbox = gtk_hbox_new(false, 0); + hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); /* * If the button was added directly to the hbox, it would be as high * as the frame widget (ugly). Adding it first to a vbox makes it have * a box shape. */ - vbox = gtk_vbox_new(true, 0); - timer_reset_button = button_add_stock(vbox, GTK_STOCK_REFRESH, false); + vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); + timer_reset_button = button_add_stock(vbox, "view-refresh", false); g_signal_connect(G_OBJECT(timer_reset_button), "clicked", G_CALLBACK(timer_reset_callback), GINT_TO_POINTER(id)); gtk_box_pack_start(GTK_BOX(hbox), vbox, false, false, 3);