summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--configure.ac2
-rw-r--r--mixgtk/mixgtk_cmd_dispatcher.c8
-rw-r--r--mixgtk/mixgtk_device.c12
-rw-r--r--mixgtk/mixgtk_fontsel.c15
-rw-r--r--mixgtk/mixgtk_gen_handlers.c3
-rw-r--r--mixgtk/mixgtk_input.c25
-rw-r--r--mixgtk/mixgtk_mixvm.c17
-rw-r--r--mixgtk/mixgtk_widgets.c29
-rw-r--r--mixgtk/mixgtk_wm.c17
9 files changed, 57 insertions, 71 deletions
diff --git a/configure.ac b/configure.ac
index ac57582..f43c1ef 100644
--- a/configure.ac
+++ b/configure.ac
@@ -124,7 +124,7 @@ esac],[gui=true])
dnl Check for gtk+
if test x$gui = xtrue; then
-PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.6.0 libglade-2.0 >= 2.0.0 pango >= 1.4,
+PKG_CHECK_MODULES(GTK, gtk+-3.0 >= 3.14 pango >= 1.4,
[LIBS="$LIBS $GTK_LIBS" AM_CFLAGS="$AM_CFLAGS $GTK_CFLAGS"],
[AC_MSG_WARN(Cannot find GTK+/Glade/Pango: the GUI shall not be built)
gui=false])
diff --git a/mixgtk/mixgtk_cmd_dispatcher.c b/mixgtk/mixgtk_cmd_dispatcher.c
index be58f13..12ed394 100644
--- a/mixgtk/mixgtk_cmd_dispatcher.c
+++ b/mixgtk/mixgtk_cmd_dispatcher.c
@@ -1,7 +1,7 @@
/* -*-c-*- -------------- mixgtk_cmd_dispatcher.c :
* Implementation of the functions declared in mixgtk_cmd_dispatcher.h
* ------------------------------------------------------------------
- * Copyright (C) 2001, 2002, 2004, 2006, 2007 Free Software Foundation, Inc.
+ * Copyright (C) 2001, 2002, 2004, 2006, 2007, 2019 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -411,14 +411,14 @@ on_command_prompt_key_press_event (GtkEntry *w, GdkEventKey *e, gpointer d)
#ifdef HAVE_LIBHISTORY
HIST_ENTRY *entry = NULL;
- if (key == GDK_Up)
+ if (key == GDK_KEY_Up)
{
entry = previous_history ();
if (entry && entry->line)
gtk_entry_set_text (w, entry->line);
result = TRUE;
}
- if (key == GDK_Down)
+ if (key == GDK_KEY_Down)
{
entry = next_history ();
if (entry && entry->line)
@@ -427,7 +427,7 @@ on_command_prompt_key_press_event (GtkEntry *w, GdkEventKey *e, gpointer d)
}
#endif
- if (key == GDK_Tab)
+ if (key == GDK_KEY_Tab)
{
complete_command_ ();
result = TRUE;
diff --git a/mixgtk/mixgtk_device.c b/mixgtk/mixgtk_device.c
index 1d28b6e..56804cd 100644
--- a/mixgtk/mixgtk_device.c
+++ b/mixgtk/mixgtk_device.c
@@ -1,7 +1,7 @@
/* -*-c-*- ---------------- mixgtk_device.c :
* actual types for mixgtk devices
* ------------------------------------------------------------------
- * Copyright (C) 2001, 2002, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+ * Copyright (C) 2001, 2002, 2004, 2005, 2006, 2007, 2008, 2019 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -480,11 +480,17 @@ mixgtk_device_set_format (mix_device_type_t dev, gboolean dec)
}
+static gpointer
+combo_child_ ()
+{
+ return gtk_bin_get_child (GTK_BIN (combo_));
+}
+
static mix_device_type_t
get_device_idx_ (void)
{
int k;
- const gchar *name = gtk_entry_get_text (GTK_ENTRY (GTK_BIN (combo_)->child));
+ const gchar *name = gtk_entry_get_text (GTK_ENTRY (combo_child_ ()));
for (k = 0; k <= LAST_BIN_DEV_; ++k)
if (!strcmp (name, DEF_NAMES_[k])) break;
return k;
@@ -504,7 +510,7 @@ init_devform_ (void)
combo_ = mixgtk_widget_factory_get_child_by_name
(MIXGTK_DEVFORM_DIALOG, "dev_combo");
g_assert (combo_);
- gtk_editable_set_editable (GTK_EDITABLE (GTK_BIN (combo_)->child), FALSE);
+ gtk_editable_set_editable (GTK_EDITABLE (combo_child_ ()), FALSE);
}
void
diff --git a/mixgtk/mixgtk_fontsel.c b/mixgtk/mixgtk_fontsel.c
index f1674ef..ac5c881 100644
--- a/mixgtk/mixgtk_fontsel.c
+++ b/mixgtk/mixgtk_fontsel.c
@@ -1,7 +1,7 @@
/* -*-c-*- -------------- mixgtk_fontsel.c :
* Implementation of the functions declared in mixgtk_fontsel.h
* ------------------------------------------------------------------
- * Copyright (C) 2001, 2004, 2006, 2007, 2008 Free Software Foundation, Inc.
+ * Copyright (C) 2001, 2004, 2006, 2007, 2008, 2019 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -28,7 +28,8 @@
#include "mixgtk_device.h"
#include "mixgtk_fontsel.h"
-static GtkFontSelectionDialog *fontsel_dialog_ = NULL;
+static GtkFontChooserDialog *fontsel_dialog_ = NULL;
+#define FONTSEL_ GTK_FONT_CHOOSER (fontsel_dialog_)
static const gchar *keys_[MIX_FONT_NO] = {
"MIX.font", "Prompt.font", "Log.font", "MIXAL.font", "Devices.font",
@@ -87,8 +88,7 @@ mixgtk_fontsel_query_font (mixgtk_font_t f, GtkWidget **w, size_t no)
if (!fontsel_dialog_) init_fontsel_ ();
current = mixgtk_config_get (keys_[f]);
- gtk_font_selection_dialog_set_font_name (fontsel_dialog_,
- current? current : default_font_);
+ gtk_font_chooser_set_font (FONTSEL_, current? current : default_font_);
while (result == GTK_RESPONSE_APPLY)
{
@@ -98,7 +98,7 @@ mixgtk_fontsel_query_font (mixgtk_font_t f, GtkWidget **w, size_t no)
gint k;
mixgtk_config_update
(keys_[f],
- gtk_font_selection_dialog_get_font_name (fontsel_dialog_));
+ gtk_font_chooser_get_font (FONTSEL_));
for (k = 0; k < no; ++k)
mixgtk_fontsel_set_font (f, w[k]);
ret = TRUE;
@@ -117,8 +117,7 @@ on_all_fonts_activate (void)
if (!fontsel_dialog_) init_fontsel_ ();
current = mixgtk_config_get (keys_[MIX_FONT_DEFAULT]);
- gtk_font_selection_dialog_set_font_name (fontsel_dialog_,
- current? current : default_font_);
+ gtk_font_chooser_set_font (FONTSEL_, current? current : default_font_);
while (result == GTK_RESPONSE_APPLY)
{
@@ -126,7 +125,7 @@ on_all_fonts_activate (void)
if (result != GTK_RESPONSE_CANCEL)
{
gint k;
- current = gtk_font_selection_dialog_get_font_name (fontsel_dialog_);
+ current = gtk_font_chooser_get_font (FONTSEL_);
for (k = 0; k < MIX_FONT_NO; ++k)
mixgtk_config_update (keys_[k], current);
diff --git a/mixgtk/mixgtk_gen_handlers.c b/mixgtk/mixgtk_gen_handlers.c
index 4124b9c..010bdc1 100644
--- a/mixgtk/mixgtk_gen_handlers.c
+++ b/mixgtk/mixgtk_gen_handlers.c
@@ -185,7 +185,8 @@ on_clear_breakpoints_activate (GtkWidget *w, gpointer data)
void
on_save_on_exit_toggle (GtkWidget *w, gpointer data)
{
- mixgtk_config_set_autosave (GTK_CHECK_MENU_ITEM (w)->active);
+ gboolean active = gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (w));
+ mixgtk_config_set_autosave (active);
}
void
diff --git a/mixgtk/mixgtk_input.c b/mixgtk/mixgtk_input.c
index e49810d..9eb0316 100644
--- a/mixgtk/mixgtk_input.c
+++ b/mixgtk/mixgtk_input.c
@@ -1,7 +1,7 @@
/* -*-c-*- -------------- mixgtk_input.c :
* Implementation of the functions declared in mixgtk_input.h
* ------------------------------------------------------------------
- * Copyright (C) 2001, 2002, 2004, 2006, 2007 Free Software Foundation, Inc.
+ * Copyright (C) 2001, 2002, 2004, 2006, 2007, 2019 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -136,14 +136,14 @@ on_word_sign_changed (GtkEditable *sign, gpointer *data)
mix_word_t w =
mix_word_new (atoi (gtk_entry_get_text (GTK_ENTRY (childs_[DEC_]))));
- g_signal_handlers_block_by_func (GTK_OBJECT (sign),
+ g_signal_handlers_block_by_func (sign,
on_word_sign_changed, data);
if (txt[0] != '+' && txt[0] != '-') txt[0] = '+';
gtk_editable_delete_text (sign, 0, 1);
gtk_editable_insert_text (sign, txt, 1, &pos);
- g_signal_handlers_unblock_by_func (GTK_OBJECT (sign),
+ g_signal_handlers_unblock_by_func (sign,
on_word_sign_changed, data);
set_word_ (txt[0] == '-' ? mix_word_negative (w) : w);
}
@@ -202,13 +202,10 @@ set_word_ (mix_word_t word)
g_snprintf (BUFFER, SIZE, "%s%d", neg ? "-" : "", val);
- g_signal_handlers_block_by_func (GTK_OBJECT (childs_[DEC_]),
- on_word_dec_changed, NULL);
- g_signal_handlers_block_by_func (GTK_OBJECT (childs_[SIGN_]),
- on_word_sign_changed, NULL);
+ g_signal_handlers_block_by_func (childs_[DEC_], on_word_dec_changed, NULL);
+ g_signal_handlers_block_by_func (childs_[SIGN_], on_word_sign_changed, NULL);
for (k = B1_; k <= B5_; ++k)
- g_signal_handlers_block_by_func (GTK_OBJECT (childs_[k]),
- on_word_byte_changed, NULL);
+ g_signal_handlers_block_by_func (childs_[k], on_word_byte_changed, NULL);
gtk_entry_set_text (GTK_ENTRY (childs_[DEC_]), BUFFER);
gtk_entry_set_text (GTK_ENTRY (childs_[SIGN_]), neg ? "-" : "+");
@@ -221,11 +218,7 @@ set_word_ (mix_word_t word)
}
for (k = B1_; k <= B5_; ++k)
- g_signal_handlers_unblock_by_func (GTK_OBJECT (childs_[k]),
- on_word_byte_changed, NULL);
- g_signal_handlers_unblock_by_func (GTK_OBJECT (childs_[DEC_]),
- on_word_dec_changed, NULL);
- g_signal_handlers_unblock_by_func (GTK_OBJECT (childs_[SIGN_]),
- on_word_sign_changed, NULL);
+ g_signal_handlers_unblock_by_func (childs_[k], on_word_byte_changed, NULL);
+ g_signal_handlers_unblock_by_func (childs_[DEC_], on_word_dec_changed, NULL);
+ g_signal_handlers_unblock_by_func (childs_[SIGN_], on_word_sign_changed, NULL);
}
-
diff --git a/mixgtk/mixgtk_mixvm.c b/mixgtk/mixgtk_mixvm.c
index 268bc25..777c6f3 100644
--- a/mixgtk/mixgtk_mixvm.c
+++ b/mixgtk/mixgtk_mixvm.c
@@ -1,7 +1,7 @@
/* -*-c-*- -------------- mixgtk_mixvm.c :
* Implementation of the functions declared in mixgtk_mixvm.h
* ------------------------------------------------------------------
- * Copyright (C) 2001, 2002, 2004, 2006, 2007, 2008 Free Software Foundation, Inc.
+ * Copyright (C) 2001, 2002, 2004, 2006, 2007, 2008, 2019 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -258,31 +258,37 @@ mixgtk_mixvm_update_vm_widgets (void)
/* update cmp flag */
+static gboolean
+button_active_ (GtkWidget *widget)
+{
+ return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
+}
+
void
on_cmp_e_toggled (GtkWidget *widget, gpointer data)
{
- if (GTK_TOGGLE_BUTTON (widget)->active)
+ if (button_active_ (widget))
mix_vm_set_cmpflag (vm_, mix_EQ);
}
void
on_cmp_l_toggled (GtkWidget *widget, gpointer data)
{
- if (GTK_TOGGLE_BUTTON (widget)->active)
+ if (button_active_ (widget))
mix_vm_set_cmpflag (vm_, mix_LESS);
}
void
on_cmp_g_toggled (GtkWidget *widget, gpointer data)
{
- if (GTK_TOGGLE_BUTTON (widget)->active)
+ if (button_active_ (widget))
mix_vm_set_cmpflag (vm_, mix_GREAT);
}
void
on_overflow_toggled (GtkWidget *widget, gpointer data)
{
- mix_vm_set_overflow (vm_, GTK_TOGGLE_BUTTON (widget)->active);
+ mix_vm_set_overflow (vm_, button_active_ (widget));
}
void
@@ -532,4 +538,3 @@ init_mem_ (void)
return TRUE;
}
-
diff --git a/mixgtk/mixgtk_widgets.c b/mixgtk/mixgtk_widgets.c
index 2bfff34..112e412 100644
--- a/mixgtk/mixgtk_widgets.c
+++ b/mixgtk/mixgtk_widgets.c
@@ -1,7 +1,7 @@
/* -*-c-*- -------------- mixgtk_widgets.c :
* Implementation of the functions declared in mixgtk_widgets.h
* ------------------------------------------------------------------
- * Copyright (C) 2001, 2004, 2006, 2007, 2014 Free Software Foundation, Inc.
+ * Copyright (C) 2001, 2004, 2006, 2007, 2014, 2019 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -21,7 +21,6 @@
#include <unistd.h>
-#include <glade/glade.h>
#include <mixlib/mix.h>
#include "mixgtk_config.h"
#include "mixgtk_widgets.h"
@@ -84,18 +83,11 @@ static const gchar *names_[] = {
#define WIDGET_NO_ (sizeof (names_) / sizeof (names_[0]))
/* the glade specs */
-static GladeXML *xml_[DLG_NO_] = {NULL};
+static GtkBuilder *builder_ = NULL;
/* the xml file name */
static const gchar *file_ = NULL;
-static void init_xml_ (mixgtk_dialog_id_t dlg)
-{
- xml_[dlg] = glade_xml_new (file_, dnames_[dlg], NULL);
- glade_xml_signal_autoconnect (xml_[dlg]);
- g_assert (xml_[dlg] != NULL);
-}
-
/* create a new factory from an xml glade file */
gboolean
mixgtk_widget_factory_init (void)
@@ -103,20 +95,16 @@ mixgtk_widget_factory_init (void)
if (!file_)
{
const gchar *glade_file = GLADE_FILE;
- glade_init ();
if (access (glade_file, R_OK)) {
if (access (LOCAL_GLADE_FILE, R_OK)) return FALSE;
glade_file = LOCAL_GLADE_FILE;
}
file_ = g_strdup (glade_file);
- }
- else
- {
- gint k;
- for (k = 0; k < DLG_NO_; ++k) if (xml_[k]) xml_[k] = NULL;
+ builder_ = gtk_builder_new_from_file (file_);
+ g_assert (builder_);
+ gtk_builder_connect_signals (builder_, NULL);
}
- init_xml_ (MIXGTK_MAIN);
return TRUE;
}
@@ -134,9 +122,7 @@ GtkWidget *
mixgtk_widget_factory_get_dialog (mixgtk_dialog_id_t dlg)
{
g_assert (dlg < DLG_NO_);
-
- if (!xml_[dlg]) init_xml_ (dlg);
- return glade_xml_get_widget (xml_[dlg], dnames_[dlg]);
+ return GTK_WIDGET (gtk_builder_get_object (builder_, dnames_[dlg]));
}
GtkWidget *
@@ -145,6 +131,5 @@ mixgtk_widget_factory_get_child_by_name (mixgtk_dialog_id_t dlg,
{
g_assert (dlg < DLG_NO_);
g_assert (name != NULL);
- if (!xml_[dlg]) init_xml_ (dlg);
- return glade_xml_get_widget (xml_[dlg], name);
+ return GTK_WIDGET (gtk_builder_get_object (builder_, dnames_[dlg]));
}
diff --git a/mixgtk/mixgtk_wm.c b/mixgtk/mixgtk_wm.c
index 93f64ca..39d54cb 100644
--- a/mixgtk/mixgtk_wm.c
+++ b/mixgtk/mixgtk_wm.c
@@ -1,7 +1,7 @@
/* -*-c-*- -------------- mixgtk_wm.c :
* Implementation of the functions declared in mixgtk_wm.h
* ------------------------------------------------------------------
- * Copyright (C) 2001, 2002, 2004, 2006, 2007, 2008 Free Software Foundation, Inc.
+ * Copyright (C) 2001, 2002, 2004, 2006, 2007, 2008, 2019 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -197,10 +197,10 @@ on_attach_toggled (GtkCheckMenuItem *item)
for (k = 0; k < INF_NO_; ++k)
if (item == infos_[k].menu) break;
g_return_if_fail (k < INF_NO_);
- if (item->active) mixgtk_wm_detach_window (k);
+ gboolean active = gtk_check_menu_item_get_active (item);
+ if (active) mixgtk_wm_detach_window (k);
else mixgtk_wm_attach_window (k);
- mixgtk_config_update (infos_[k].config_key,
- (item->active)? DETACH_YES_ : DETACH_NO_);
+ mixgtk_config_update (infos_[k].config_key, active? DETACH_YES_ : DETACH_NO_);
}
void
@@ -216,8 +216,8 @@ on_window_hide (GtkWidget *w)
void
on_show_toolbars_toggled (GtkCheckMenuItem *item)
{
- if (item->active != mixgtk_config_show_toolbars ())
- show_toolbars_ (item->active);
+ gboolean active = gtk_check_menu_item_get_active (item);
+ if (active != mixgtk_config_show_toolbars ()) show_toolbars_ (active);
}
void
@@ -426,7 +426,7 @@ init_dev_ (void)
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
- gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (page), devs);
+ gtk_container_add (GTK_CONTAINER (page), devs);
infos_[MIXGTK_DEVICES_WINDOW].widget = page;
@@ -664,6 +664,3 @@ update_attach_buttons_ (void)
gtk_tool_item_set_visible_horizontal (detach_button_, wants_detach);
gtk_tool_item_set_visible_vertical (detach_button_, wants_detach);
}
-
-
-