summaryrefslogtreecommitdiffhomepage
path: root/mixgtk/mixgtk_widgets.c
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2019-01-12 19:31:20 +0000
committerJose Antonio Ortega Ruiz <jao@gnu.org>2020-10-18 17:47:53 +0100
commit1953e0b4b6a0317131df2de1b0f2c0483ad7690e (patch)
tree9d0aa83383af9a917863d0cac6f3ef4ced8b0219 /mixgtk/mixgtk_widgets.c
parent1cfdfe433c8c8dcb40a0813528d7d0e0bb5ae2b6 (diff)
downloadmdk-1953e0b4b6a0317131df2de1b0f2c0483ad7690e.tar.gz
mdk-1953e0b4b6a0317131df2de1b0f2c0483ad7690e.tar.bz2
Mirgration to GTK+3: seemingly safe changes
Diffstat (limited to 'mixgtk/mixgtk_widgets.c')
-rw-r--r--mixgtk/mixgtk_widgets.c29
1 files changed, 7 insertions, 22 deletions
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]));
}