Mailinglist Archive: libyui-devel (9 mails)

< Previous Next >
Re: [libyui-devel] libyui-gtk build failure because of deprecated gtk_vbox_get_type
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I fully agree, the needed changes seem to be trivial. Any gtk
guys around who have experience in porting code to the latest gtk
version?

Well I'm not :)

but i started to try working on it.

Attached patch does not solve all the deprecated problem, but
builds on the machine that does not have the problem yet (mageia 3),
and only partially in cauldron one.

Before having any headaches for trying to understand other Gtk
things, I'd like to understand if this approach could be seen
as correct, and maybe if it does not have regressions, since
I'm just shooting in the dark. I don't use and compile graph
packages for instance...

I experienced a segmentation fault running ManyWidgets example
in gtk, butalso i tried it without my patch and crashed
anyway, that's odd since i used it -working- for my previous
branch and YTable changes -aborted at the moment-.

Cheers,
Angelo

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.13 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEARECAAYFAlHT//AACgkQqEs9DA4DquDetQCeNbQZ0MsVYFn1N1HvjF+S70u/
RqQAoJDT3qL9A7QXVLCyVPk6n4Ud/AwT
=6A2v
-----END PGP SIGNATURE-----
diff --git a/src/YGBarGraph.cc b/src/YGBarGraph.cc
index cb50185..3166a83 100644
--- a/src/YGBarGraph.cc
+++ b/src/YGBarGraph.cc
@@ -70,7 +70,7 @@ public:
const std::string &newPartLabel, const std::string
&freeFieldLabel, const std::string &newPartFieldLabel)
: YPartitionSplitter (NULL, usedSize, totalFreeSize, newPartSize,
minNewPartSize,
minFreeSize, usedLabel, freeLabel, newPartLabel,
freeFieldLabel, newPartFieldLabel)
- , YGWidget (this, parent, GTK_TYPE_VBOX, NULL)
+ , YGWidget (this, parent, gtk_box_new(GTK_ORIENTATION_VERTICAL, 0))
{
/* Bar graph widget */
GtkWidget *graph = ygtk_bar_graph_new();
diff --git a/src/YGDialog.cc b/src/YGDialog.cc
index 96d4703..4d45c92 100644
--- a/src/YGDialog.cc
+++ b/src/YGDialog.cc
@@ -295,7 +295,7 @@ private:

YGDialog::YGDialog (YDialogType dialogType, YDialogColorMode colorMode)
: YDialog (dialogType, colorMode),
- YGWidget (this, NULL, GTK_TYPE_HBOX, NULL)
+ YGWidget (this, NULL, gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0))
{
setBorder (0);
m_stickyTitle = false;
diff --git a/src/YGIntField.cc b/src/YGIntField.cc
index 64d6471..9ed1c74 100644
--- a/src/YGIntField.cc
+++ b/src/YGIntField.cc
@@ -16,7 +16,7 @@ public:
YGSpinBox (YWidget *ywidget, YWidget *parent, const std::string &label,
int minValue, int maxValue, int initialValue, bool
show_slider)
: YGLabeledWidget (ywidget, parent, label, YD_HORIZ,
- GTK_TYPE_HBOX, "spacing", 6, NULL)
+ gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6))
{
m_spiner = gtk_spin_button_new_with_range (minValue, maxValue,
1);

diff --git a/src/YGWidget.cc b/src/YGWidget.cc
index bec1d26..c3092b0 100644
--- a/src/YGWidget.cc
+++ b/src/YGWidget.cc
@@ -63,6 +63,42 @@ YGWidget::YGWidget(YWidget *ywidget, YWidget *yparent,
va_end (args);
}

+YGWidget::YGWidget (YWidget *ywidget, YWidget *yparent,
+ GtkWidget *pGtkWdiget)
+ : m_ywidget (ywidget)
+{
+ construct (ywidget, yparent, pGtkWdiget);
+}
+
+void YGWidget::construct (YWidget* ywidget, YWidget* yparent,
+ GtkWidget* pGtkWdiget)
+{
+ m_widget = pGtkWdiget;
+ if (GTK_IS_WINDOW(pGtkWdiget) || GTK_IS_MENU(pGtkWdiget) )
+ {
+ m_adj_size = m_widget;
+ }
+ else
+ {
+ m_adj_size = ygtk_adj_size_new();
+ g_object_ref_sink (G_OBJECT (m_adj_size));
+ gtk_widget_show (m_adj_size);
+ gtk_container_add (GTK_CONTAINER (m_adj_size), m_widget);
+ ygtk_adj_size_set_min_cb (YGTK_ADJ_SIZE (m_adj_size), min_size_cb, this);
+ }
+ gtk_widget_show (m_widget);
+
+ // Split by two so that with another widget it will have full border...
+ setBorder (DEFAULT_BORDER / 2);
+
+ ywidget->setWidgetRep ((void *) this);
+ if (yparent) {
+ ywidget->setParent (yparent);
+ yparent->addChild (ywidget);
+ }
+ m_signals = NULL;
+}
+
void YGWidget::construct (YWidget *ywidget, YWidget *yparent,
GType type, const char *property_name, va_list args)
{
@@ -222,12 +258,35 @@ void YGWidget::setBorder (unsigned int border)

/* YGLabeledWidget follows */

+YGLabeledWidget::YGLabeledWidget ( YWidget* ywidget, YWidget* yparent, const
std::string& label_text, YUIDimension label_ori, GtkWidget* pGtkWdiget )
+ : YGWidget ( ywidget, yparent, gtk_box_new(GTK_ORIENTATION_VERTICAL,
LABEL_WIDGET_SPACING) )
+{
+ m_field = pGtkWdiget;
+
+ // Create the label
+ m_label = gtk_label_new ("");
+ gtk_misc_set_alignment (GTK_MISC (m_label), 0.0, 0.5);
+/* if (label_ori == YD_HORIZ)
+ gtk_label_set_line_wrap (GTK_LABEL (m_label), TRUE);*/
+ gtk_widget_show (m_label);
+ gtk_widget_show (m_field);
+
+ setBuddy (m_field);
+ doSetLabel (label_text);
+
+ // Set the container and show widgets
+ gtk_box_pack_start (GTK_BOX (m_widget), m_label, FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (m_widget), m_field, TRUE, TRUE, 0);
+ m_orientation = label_ori;
+}
+
+
YGLabeledWidget::YGLabeledWidget (YWidget *ywidget, YWidget *parent,
const std::string &label_text, YUIDimension
label_ori,
GType type, const char *property_name, ...)
: YGWidget (ywidget, parent,
// label_ori == YD_VERT ? GTK_TYPE_VBOX : GTK_TYPE_HBOX,
- GTK_TYPE_VBOX, "spacing", LABEL_WIDGET_SPACING, NULL)
+ gtk_box_new(GTK_ORIENTATION_VERTICAL, LABEL_WIDGET_SPACING))
{
// Create the field widget
va_list args;
diff --git a/src/YGWidget.h b/src/YGWidget.h
index 9bfd806..07f8f22 100644
--- a/src/YGWidget.h
+++ b/src/YGWidget.h
@@ -15,6 +15,9 @@ class YGWidget
public:
YGWidget (YWidget *ywidget, YWidget *yparent,
GType type, const char *property_name, ...);
+
+ YGWidget (YWidget *ywidget, YWidget *yparent,
+ GtkWidget *pGtkWdiget);
virtual ~YGWidget();

// get the YGWidget associated with a YWidget
@@ -62,6 +65,8 @@ protected:

void construct (YWidget *ywidget, YWidget *yparent,
GType type, const char *property_name, va_list args);
+ void construct (YWidget *ywidget, YWidget *yparent,
+ GtkWidget *pGtkWdiget);

// data
GtkWidget *m_widget, *m_adj_size; // associated GtkWidget, and
adjustment for borders
@@ -117,6 +122,9 @@ struct BlockEvents
class YGLabeledWidget : public YGWidget
{
public:
+ YGLabeledWidget(YWidget *ywidget, YWidget *yparent,
+ const std::string &label_text, YUIDimension
label_ori,
+ GtkWidget *pGtkWdiget);
YGLabeledWidget(YWidget *ywidget, YWidget *yparent,
const std::string &label_text, YUIDimension
label_ori,
GType type, const char *property_name, ...);
< Previous Next >
List Navigation