Hello community,
here is the log from the commit of package yast2-gtk
checked in at Fri Mar 16 14:37:08 CET 2007.
--------
--- yast2-gtk/yast2-gtk.changes 2007-02-07 11:26:32.000000000 +0100
+++ /mounts/work_src_done/STABLE/yast2-gtk/yast2-gtk.changes 2007-03-16 13:37:13.830631000 +0100
@@ -1,0 +2,5 @@
+Fri Mar 16 13:36:04 CET 2007 - mmichael@suse.de
+
+- upgrade to yast2-gtk-2.15.1, several fixes, including #247682, #247683
+
+-------------------------------------------------------------------
Old:
----
yast2-gtk-2.15.0.tar.bz2
New:
----
yast2-gtk-2.15.1.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ yast2-gtk.spec ++++++
--- /var/tmp/diff_new_pack.WZ8918/_old 2007-03-16 14:36:57.000000000 +0100
+++ /var/tmp/diff_new_pack.WZ8918/_new 2007-03-16 14:36:57.000000000 +0100
@@ -1,5 +1,5 @@
#
-# spec file for package yast2-gtk (Version 2.15.0)
+# spec file for package yast2-gtk (Version 2.15.1)
#
# Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
@@ -13,7 +13,7 @@
Name: yast2-gtk
URL: http://en.opensuse.org/YaST2-GTK
BuildRequires: blocxx-devel gcc-c++ gtk2-devel libxcrypt-devel libzypp-devel yast2-core-devel yast2-devel yast2-devtools
-Version: 2.15.0
+Version: 2.15.1
Release: 1
License: GNU Library General Public License v. 2.0 and 2.1 (LGPL)
Group: System/Management
@@ -55,7 +55,9 @@
%doc AUTHORS ChangeLog NEWS README TODO
%{_libdir}/YaST2/plugin/*
-%changelog -n yast2-gtk
+%changelog
+* Fri Mar 16 2007 - mmichael@suse.de
+- upgrade to yast2-gtk-2.15.1, several fixes, including #247682, #247683
* Wed Feb 07 2007 - mmichael@suse.de
- update to yast2-gtk-2.15.0, fixes build and adds new Frame type
* Wed Aug 30 2006 - cthiel@suse.de
++++++ yast2-gtk-2.15.0.tar.bz2 -> yast2-gtk-2.15.1.tar.bz2 ++++++
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-gtk-2.15.0/ChangeLog new/yast2-gtk-2.15.1/ChangeLog
--- old/yast2-gtk-2.15.0/ChangeLog 2007-02-07 11:20:48.000000000 +0100
+++ new/yast2-gtk-2.15.1/ChangeLog 2007-03-16 13:36:17.000000000 +0100
@@ -1,6 +1,94 @@
+2007-03-16 Michael Meeks
+
+ * Version 2.15.1
+
+2007-03-16 Michael Meeks
+
+ * src/YGFrame.cc (YGCheckBoxFrame::setLabel),
+ (YGFrame::setLabel): fix daft accelerator translation
+ bug & refactor to:
+ * src/YGUtils.cc (setLabel): impl. helper
+
+ * src/YGIntField.cc (class YGSpinBox): only connect to
+ slider signal if we have a slider.
+
+2007-03-15 Ricardo Cruz
+
+ * src/ygtkrichtext.c: fix bug 247682: convert the key to unicode.
+ And some cleaning.
+
+ * src/ygtkratiobox.h/c (YGtkMinSize): added set_only_expand() property
+ which makes the child greed :), always asking for more space.
+ * YGDumbTab.cc: make use of it.
+
+ * src/YGWidget.cc (safe_stretchability): made it an exception to consider
+ safe to ask for the stretchability of a ysplit without children (bug fix:
+ notebook from edit in network.ycp goes stretchable in one page and not
+ stretchable in the other).
+ This work around for the fact that stretchable() crashes when it has no
+ children should really be fixed upstream.
+
+2007-03-15 Michael Meeks
+
+ * Makefile.am: remove generated file.
+
+ * src/YGUI.h, src/YGFrame.cc: createCheckBoxFrame crept
+ into the stable release post 2.13.32, adapt to that too.
+
+2007-03-14 Ricardo Cruz
+
+ * configure.in.in: use the version numbering from
+ "pkg-config --modversion yast2-core" as suggested by
+ Martin Vidner. Removed my has_checkboxframe check.
+
+ * YGLayout.cc (YGAlignment): honor child stretchable when set
+ stretchable (special case that YAlignment does).
+ * YGWizard.cc: make use of previous; things like loading messages
+ on some modules were not centered -- this fixes that.
+
+ * YGLabel.cc: instead of using a GtkEntry for isOutputField, use
+ a regular label. This supports multiple lines and from the places
+ it is used it looks just as good (just made it selectable).
+
+ * YGUtils.cc: added replace() that replaces a character in a
+ string (which mapKBAccel() now uses). Fixed bug on setWidgetFont()
+ (arguments were not being honored).
+
+ * src/YGUI.cc: cleaned up the file selection code wrt path fed.
+ * tests/FileDialog.ycp: easy app to test the file/folder selectors.
+
+ * src/ygtkwizard.c: seems like I had forgotten to double some
+ padding value for size request... This tiny little thing was
+ reponsible for a weird warning and wasting my time. :/
+
+ * src/ygtkrichtext.c: fix bug 247682: convert the key to unicode.
+ And some cleaning.
+
+2007-03-13 Ricardo Cruz
+
+ * YGPackageSelector.cc: made the package information to
+ use tabs.
+
+ * YGUI.cc: couldn't reproduce bug #247802, but cleaned
+ up file chooser code as it is not good. Done a few tests;
+ all fine.
+
+ * configure.in.in & config.h.in: added HAS_CHECKBOXFRAME
+ define according to if YCheckBoxFrame.h is available or
+ not. YAST2_VERSION would work nice, if yast guys would
+ have changed the version number since the opensuse 10.2
+ release. :/
+
+ * src/YGIntField.cc: set scale to not jump much for small
+ values.
+
+ * src/YGLayout.cc: fixes bug #247683 (crash on language.ycp).
+ This also happen in programs like network.ycp, wrt a
+ childless container.
+
2007-02-07 Michael Meeks
- * Version 2.15.0
+ * Version 2.15.0 - Rev 388
* src/Makefile.am (EXTRA_DIST): computer.xpm
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-gtk-2.15.0/configure new/yast2-gtk-2.15.1/configure
--- old/yast2-gtk-2.15.0/configure 2007-02-07 11:18:26.000000000 +0100
+++ new/yast2-gtk-2.15.1/configure 2007-03-16 13:36:22.000000000 +0100
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.59 for yast2-gtk 2.15.0.
+# Generated by GNU Autoconf 2.59 for yast2-gtk 2.15.1.
#
# Report bugs to http://bugs.opensuse.org/.
#
@@ -423,8 +423,8 @@
# Identity of this package.
PACKAGE_NAME='yast2-gtk'
PACKAGE_TARNAME='yast2-gtk'
-PACKAGE_VERSION='2.15.0'
-PACKAGE_STRING='yast2-gtk 2.15.0'
+PACKAGE_VERSION='2.15.1'
+PACKAGE_STRING='yast2-gtk 2.15.1'
PACKAGE_BUGREPORT='http://bugs.opensuse.org/'
ac_unique_file="RPMNAME"
@@ -979,7 +979,7 @@
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures yast2-gtk 2.15.0 to adapt to many kinds of systems.
+\`configure' configures yast2-gtk 2.15.1 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1046,7 +1046,7 @@
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of yast2-gtk 2.15.0:";;
+ short | recursive ) echo "Configuration of yast2-gtk 2.15.1:";;
esac
cat <<\_ACEOF
@@ -1194,7 +1194,7 @@
test -n "$ac_init_help" && exit 0
if $ac_init_version; then
cat <<\_ACEOF
-yast2-gtk configure 2.15.0
+yast2-gtk configure 2.15.1
generated by GNU Autoconf 2.59
Copyright (C) 2003 Free Software Foundation, Inc.
@@ -1208,7 +1208,7 @@
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by yast2-gtk $as_me 2.15.0, which was
+It was created by yast2-gtk $as_me 2.15.1, which was
generated by GNU Autoconf 2.59. Invocation command line was
$ $0 $@
@@ -1938,7 +1938,7 @@
# Define the identity of the package.
PACKAGE='yast2-gtk'
- VERSION='2.15.0'
+ VERSION='2.15.1'
cat >>confdefs.h <<_ACEOF
@@ -2149,7 +2149,7 @@
-VERSION="2.15.0"
+VERSION="2.15.1"
RPMNAME="yast2-gtk"
MAINTAINER="Wild Mongoose "
@@ -20473,7 +20473,7 @@
-verstxt=`y2tool version`
+verstxt=`pkg-config --modversion yast2-core`
vers=`echo "$verstxt" | awk -F. '{ printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
cat >>confdefs.h <<_ACEOF
@@ -20879,7 +20879,7 @@
} >&5
cat >&5 <<_CSEOF
-This file was extended by yast2-gtk $as_me 2.15.0, which was
+This file was extended by yast2-gtk $as_me 2.15.1, which was
generated by GNU Autoconf 2.59. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -20942,7 +20942,7 @@
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
-yast2-gtk config.status 2.15.0
+yast2-gtk config.status 2.15.1
configured by $0, generated by GNU Autoconf 2.59,
with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-gtk-2.15.0/configure.in new/yast2-gtk-2.15.1/configure.in
--- old/yast2-gtk-2.15.0/configure.in 2007-02-07 11:18:16.000000000 +0100
+++ new/yast2-gtk-2.15.1/configure.in 2007-03-16 13:36:12.000000000 +0100
@@ -3,7 +3,7 @@
dnl -- This file is generated by y2autoconf 2.13.18 - DO NOT EDIT! --
dnl (edit configure.in.in instead)
-AC_INIT(yast2-gtk, 2.15.0, http://bugs.opensuse.org/, yast2-gtk)
+AC_INIT(yast2-gtk, 2.15.1, http://bugs.opensuse.org/, yast2-gtk)
dnl Check for presence of file 'RPMNAME'
AC_CONFIG_SRCDIR([RPMNAME])
@@ -17,7 +17,7 @@
AM_INIT_AUTOMAKE(tar-ustar) dnl searches for some needed programs
dnl Important YaST2 variables
-VERSION="2.15.0"
+VERSION="2.15.1"
RPMNAME="yast2-gtk"
MAINTAINER="Wild Mongoose "
@@ -193,7 +193,7 @@
AC_SUBST(GTK_CFLAGS)
AC_SUBST(GTK_LIBS)
-verstxt=`y2tool version`
+verstxt=`pkg-config --modversion yast2-core`
vers=`echo "$verstxt" | awk -F. '{ printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
AC_DEFINE_UNQUOTED(YAST2_VERSION, $vers, [yast version for compile conditionals])
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-gtk-2.15.0/configure.in.in new/yast2-gtk-2.15.1/configure.in.in
--- old/yast2-gtk-2.15.0/configure.in.in 2007-02-07 11:18:13.000000000 +0100
+++ new/yast2-gtk-2.15.1/configure.in.in 2007-03-15 10:57:53.000000000 +0100
@@ -43,7 +43,7 @@
AC_SUBST(GTK_CFLAGS)
AC_SUBST(GTK_LIBS)
-verstxt=`y2tool version`
+verstxt=`pkg-config --modversion yast2-core`
vers=`echo "$verstxt" | awk -F. '{ printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
AC_DEFINE_UNQUOTED(YAST2_VERSION, $vers, [yast version for compile conditionals])
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-gtk-2.15.0/src/YGDumbTab.cc new/yast2-gtk-2.15.1/src/YGDumbTab.cc
--- old/yast2-gtk-2.15.0/src/YGDumbTab.cc 2007-02-05 13:45:30.000000000 +0100
+++ new/yast2-gtk-2.15.1/src/YGDumbTab.cc 2007-03-16 12:36:40.000000000 +0100
@@ -8,10 +8,10 @@
#include "YGUtils.h"
#include "YDumbTab.h"
+#include "ygtkratiobox.h"
+
class YGDumbTab : public YDumbTab, public YGWidget
{
- GtkRequisition m_label_req;
-
GtkWidget *m_containee;
GtkWidget *m_last_tab;
vector m_tab_widgets;
@@ -28,7 +28,10 @@
gtk_object_sink (GTK_OBJECT (m_containee));
m_last_tab = 0;
- m_label_req.width = m_label_req.height = 0;
+ // GTK+ keeps the notebook size set to the biggset page. We can't
+ // do this since this is dynamic, but at least don't let the notebook
+ // reduce its size.
+ ygtk_min_size_set_only_expand (YGTK_MIN_SIZE (m_min_size), TRUE);
g_signal_connect (G_OBJECT (getWidget()), "switch-page",
G_CALLBACK (changed_tab_cb), this);
@@ -62,18 +65,6 @@
change_tab (0);
g_signal_handlers_unblock_by_func (notebook, (gpointer) changed_tab_cb, this);
-
- // for setsize and nicesize...
- int focus_width;
- gtk_widget_style_get (getWidget(), "focus-line-width", &focus_width, NULL);
-
- GtkRequisition req;
- gtk_widget_size_request (label, &req);
- req.width += (focus_width + notebook->tab_hborder + 2) * 2 + 1;
- req.height += (focus_width + notebook->tab_vborder + 2) * 2;
-
- m_label_req.width += req.width;
- m_label_req.height = MAX (req.height, m_label_req.height);
}
// to re-use the same widget in all tabs (m_fixed), we will remove and
@@ -115,7 +106,13 @@
YGWIDGET_IMPL_COMMON
YGWIDGET_IMPL_CHILD_ADDED (m_containee)
- YGWIDGET_IMPL_CHILD_REMOVED (m_containee)
+
+// YGWIDGET_IMPL_CHILD_REMOVED (m_containee)
+ virtual void childRemoved (YWidget *ychild)
+ {
+ GtkWidget *child = YGWidget::get (ychild)->getLayout();
+ gtk_container_remove (GTK_CONTAINER (m_containee), child);
+ }
};
YWidget *
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-gtk-2.15.0/src/YGFrame.cc new/yast2-gtk-2.15.1/src/YGFrame.cc
--- old/yast2-gtk-2.15.0/src/YGFrame.cc 2007-02-07 11:12:35.000000000 +0100
+++ new/yast2-gtk-2.15.1/src/YGFrame.cc 2007-03-16 13:21:52.000000000 +0100
@@ -36,13 +36,11 @@
// YFrame
virtual void setLabel (const YCPString &label)
{
- string str = "<b>" + label->value() + "</b>";
- str = YGUtils::mapKBAccel(str.c_str());
- gtk_frame_set_label (GTK_FRAME (getWidget()), str.c_str());
+ GtkWidget *lab_widget = gtk_label_new(NULL);
+ gtk_widget_show (lab_widget);
+ YGUtils::setLabel (GTK_LABEL (lab_widget), label);
+ gtk_frame_set_label_widget (GTK_FRAME (getWidget()), lab_widget);
YFrame::setLabel (label);
-
- GtkWidget *frame_label = gtk_frame_get_label_widget (GTK_FRAME (getWidget()));
- gtk_label_set_use_markup (GTK_LABEL (frame_label), TRUE);
}
YGWIDGET_IMPL_COMMON
@@ -69,8 +67,7 @@
return new YGFrame (opt, YGWidget::get (parent), label);
}
-#if YAST2_VERSION >= 2014000
-
+#if YAST2_VERSION > 2014004 || YAST2_VERSION > 2013032
#include "YCheckBoxFrame.h"
class YGCheckBoxFrame : public YCheckBoxFrame, public YGWidget
@@ -112,10 +109,7 @@
// YFrame
virtual void setLabel (const YCPString &label)
{
- string str = "<b>" + label->value() + "</b>";
- str = YGUtils::mapKBAccel(str.c_str());
- gtk_label_set_text_with_mnemonic (m_label, str.c_str());
- gtk_label_set_use_markup (GTK_LABEL (m_label), TRUE);
+ YGUtils::setLabel (GTK_LABEL (m_label), label);
YCheckBoxFrame::setLabel (label);
}
@@ -160,4 +154,5 @@
IMPL;
return new YGCheckBoxFrame (opt, YGWidget::get (parent), label, checked);
}
-#endif
+
+#endif /*YAST2_VERSION*/
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-gtk-2.15.0/src/YGIntField.cc new/yast2-gtk-2.15.1/src/YGIntField.cc
--- old/yast2-gtk-2.15.0/src/YGIntField.cc 2007-02-05 13:45:30.000000000 +0100
+++ new/yast2-gtk-2.15.1/src/YGIntField.cc 2007-03-16 12:58:36.000000000 +0100
@@ -25,7 +25,10 @@
if (show_slider) {
m_slider = gtk_hscale_new_with_range (minValue, maxValue, 1);
- gtk_scale_set_draw_value (GTK_SCALE (m_slider), FALSE);
+ if (maxValue - minValue < 20)
+ // GtkScale by default uses a step of 10 -- use a lower for low values
+ gtk_range_set_increments (GTK_RANGE (m_slider), 1, 2);
+ gtk_scale_set_draw_value (GTK_SCALE (m_slider), TRUE);
YGLabeledWidget::setBuddy (m_slider);
gtk_widget_set_size_request (m_slider,
YGUtils::getCharsWidth (m_slider, SLIDER_NICESIZE_IN_CHARS), -1);
@@ -45,15 +48,16 @@
doSetValue (initialValue);
g_signal_connect (G_OBJECT (m_spiner), "value-changed",
G_CALLBACK (spiner_changed_cb), this);
- g_signal_connect (G_OBJECT (m_slider), "value-changed",
- G_CALLBACK (slider_changed_cb), this);
+ if (m_slider)
+ g_signal_connect (G_OBJECT (m_slider), "value-changed",
+ G_CALLBACK (slider_changed_cb), this);
}
GtkSpinButton *getSpiner()
{ return GTK_SPIN_BUTTON (m_spiner); }
bool useSlider()
- { return m_slider != NULL; }
+ { return m_slider != NULL; }
GtkHScale *getSlider()
{ return GTK_HSCALE (m_slider); }
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-gtk-2.15.0/src/YGLabel.cc new/yast2-gtk-2.15.1/src/YGLabel.cc
--- old/yast2-gtk-2.15.0/src/YGLabel.cc 2007-02-05 13:45:30.000000000 +0100
+++ new/yast2-gtk-2.15.1/src/YGLabel.cc 2007-03-16 13:23:30.000000000 +0100
@@ -14,18 +14,12 @@
public:
YGLabel (const YWidgetOpt &opt, YGWidget *parent, YCPString text)
: YLabel (opt, text),
- YGWidget (this, parent, true, opt.isOutputField.value() ? GTK_TYPE_ENTRY
- : GTK_TYPE_LABEL, NULL)
+ YGWidget (this, parent, true, GTK_TYPE_LABEL, NULL)
{
IMPL
- if (opt.isOutputField.value()) {
- gtk_editable_set_editable (GTK_EDITABLE (getWidget()), FALSE);
- // not editable GtkEntrys don't really look like it, so...
- gtk_widget_modify_base (getWidget(), GTK_STATE_NORMAL,
- &getWidget()->style->base [GTK_STATE_INSENSITIVE]);
- }
- else
- gtk_misc_set_alignment (GTK_MISC (getWidget()), 0.0, 0.5);
+ gtk_misc_set_alignment (GTK_MISC (getWidget()), 0.0, 0.5);
+ if (opt.isOutputField.value())
+ gtk_label_set_selectable (GTK_LABEL (getWidget()), TRUE);
if (opt.boldFont.value())
YGUtils::setWidgetFont (getWidget(), PANGO_WEIGHT_BOLD, PANGO_SCALE_MEDIUM);
@@ -36,28 +30,17 @@
virtual void setLabel (const YCPString &label)
{
- if (GTK_IS_LABEL (getWidget()))
- gtk_label_set_label (GTK_LABEL (getWidget()), label->value_cstr());
- else
- gtk_entry_set_text (GTK_ENTRY (getWidget()), label->value_cstr());
+ gtk_label_set_label (GTK_LABEL (getWidget()), label->value_cstr());
YLabel::setLabel (label);
- // Some YCP progs have crap like no labeled labels cluttering the layout
+ // Some YCP progs have no labeled labels cluttering the layout
label->value().empty() ? gtk_widget_hide (getWidget())
: gtk_widget_show (getWidget());
}
// YWidget
virtual bool doSetKeyboardFocus()
- {
- if (GTK_IS_ENTRY (getWidget())) {
- gtk_widget_grab_focus (GTK_WIDGET(getWidget()));
- return gtk_widget_is_focus (GTK_WIDGET(getWidget()));
- }
- else // GtkLabel
- return false;
- }
-
+ { return false; }
YGWIDGET_IMPL_COMMON
};
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-gtk-2.15.0/src/YGLayout.cc new/yast2-gtk-2.15.1/src/YGLayout.cc
--- old/yast2-gtk-2.15.0/src/YGLayout.cc 2007-02-05 13:45:30.000000000 +0100
+++ new/yast2-gtk-2.15.1/src/YGLayout.cc 2007-03-15 10:57:52.000000000 +0100
@@ -51,11 +51,14 @@
// try to see if there is a YGLabeledWidget at start
// (and ignore YSpacings)
YContainerWidget *container = (YContainerWidget *) ychild;
- for (int i = 0; i < container->numChildren(); i++) {
- ychild = container->child (i);
- if (dynamic_cast (ychild) == NULL)
- break;
- }
+ if (container->numChildren())
+ for (int i = 0; i < container->numChildren(); i++) {
+ ychild = container->child (i);
+ if (!dynamic_cast (ychild))
+ break;
+ }
+ else // no kids
+ break;
}
else {
ygchild = YGWidget::get (ychild);
@@ -128,28 +131,44 @@
YGWidget *child = YGWidget::get (ychild);
gtk_container_add (GTK_CONTAINER (getWidget()), child->getLayout());
- setAlignment (align [YD_HORIZ], align [YD_VERT]);
/* The padding is used for stuff like making YCP progs nicer for
yast-qt wizard, so it hurts us -- it's disabled. */
//child->setPadding (topMargin(), bottomMargin(),
// leftMargin(), rightMargin());
setMinSize (minWidth(), minHeight());
- sync_stretchable();
+
+ sync_stretchable (ychild); // alignment will be set here
}
YGWIDGET_IMPL_CHILD_REMOVED (m_widget)
+ virtual void sync_stretchable (YWidget *child)
+ {
+ IMPL
+ setAlignment (align [YD_HORIZ], align [YD_VERT]);
+ YGWidget::sync_stretchable (m_y_widget);
+ }
+
void setAlignment (YAlignmentType halign, YAlignmentType valign)
{
- GValue zero = YGUtils::floatToGValue (0.0);
+ // special case (which YAlignment.cc also uses); let stretchable
+ // children stretch if opt.stretch is set (exploitable by the wizard)
+ GValue hstretch, vstretch;
+ hstretch = YGUtils::floatToGValue (0);
+ if (_stretch [YD_HORIZ] && YGWidget::get (child (0))->isStretchable (YD_HORIZ))
+ hstretch = YGUtils::floatToGValue (1);
+ vstretch = YGUtils::floatToGValue (0);
+ if (_stretch [YD_VERT] && YGWidget::get (child (0))->isStretchable (YD_VERT))
+ vstretch = YGUtils::floatToGValue (1);
+
if (halign != YAlignUnchanged) {
GValue xalign = YGUtils::floatToGValue (yToGtkAlign (halign));
g_object_set_property (G_OBJECT (getWidget()), "xalign", &xalign);
- g_object_set_property (G_OBJECT (getWidget()), "xscale", &zero);
+ g_object_set_property (G_OBJECT (getWidget()), "xscale", &hstretch);
}
if (valign != YAlignUnchanged) {
GValue yalign = YGUtils::floatToGValue (yToGtkAlign (valign));
g_object_set_property (G_OBJECT (getWidget()), "yalign", &yalign);
- g_object_set_property (G_OBJECT (getWidget()), "yscale", &zero);
+ g_object_set_property (G_OBJECT (getWidget()), "yscale", &vstretch);
}
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-gtk-2.15.0/src/YGPackageSelector.cc new/yast2-gtk-2.15.1/src/YGPackageSelector.cc
--- old/yast2-gtk-2.15.0/src/YGPackageSelector.cc 2007-02-05 13:45:30.000000000 +0100
+++ new/yast2-gtk-2.15.1/src/YGPackageSelector.cc 2007-03-15 10:57:52.000000000 +0100
@@ -242,67 +242,42 @@
return false;
}
-#define INFORMATION_HEIGHT 120
+#define INFORMATION_HEIGHT 140
// Expander widget with the package information
class PackageInformation
{
GtkWidget *m_widget;
// Information text
- GtkWidget *m_description_text, *m_filelist_text, *m_history_text;
- GtkWidget *m_scrolled_window;
+ GtkWidget *m_about_text, *m_authors_text, *m_filelist_text, *m_history_text;
public:
PackageInformation (const char *expander_text, bool only_description)
{
- // TODO: set white color on expanders
- GtkWidget *padding_widget, *vbox, *view_port;
m_widget = gtk_expander_new (expander_text);
-
- padding_widget = gtk_hbox_new (FALSE, 0);
-
- view_port = gtk_viewport_new (NULL, NULL);
- gtk_viewport_set_shadow_type (GTK_VIEWPORT (view_port), GTK_SHADOW_NONE);
- m_scrolled_window = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (m_scrolled_window),
- GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- gtk_scrolled_window_add_with_viewport
- (GTK_SCROLLED_WINDOW (m_scrolled_window), view_port);
-
- vbox = gtk_vbox_new (FALSE, 0);
- gtk_container_add (GTK_CONTAINER (view_port), vbox);
- gtk_box_pack_start (GTK_BOX (padding_widget), m_scrolled_window,
- TRUE, TRUE, 15);
- gtk_container_add (GTK_CONTAINER (m_widget), padding_widget);
-
- m_description_text = ygtk_richtext_new ();
- ygtk_richtext_set_text (YGTK_RICHTEXT (m_description_text),
- "<i>(no package selected)</i>", FALSE, TRUE);
- gtk_box_pack_start (GTK_BOX (vbox), m_description_text, FALSE, FALSE, 0);
+ gtk_widget_set_sensitive (m_widget, FALSE);
if (only_description) {
- m_filelist_text = NULL;
- m_history_text = NULL;
+ GtkWidget *about_win = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (about_win),
+ GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
+ m_about_text = ygtk_richtext_new();
+ gtk_container_add (GTK_CONTAINER (about_win), m_about_text);
+ gtk_container_add (GTK_CONTAINER (m_widget), about_win);
+ m_authors_text = m_filelist_text = m_history_text = NULL;
}
else {
- GtkWidget *filelist_expander, *history_expander;
-// GdkColor white = { 0, 255 << 8, 255 << 8, 255 << 8 };
-
- filelist_expander = gtk_expander_new ("File listing");
- m_filelist_text = ygtk_richtext_new ();
- gtk_container_add (GTK_CONTAINER (filelist_expander), m_filelist_text);
- gtk_box_pack_start (GTK_BOX (vbox), filelist_expander, FALSE, FALSE, 0);
-
- history_expander = gtk_expander_new ("Packaging History");
- m_history_text = ygtk_richtext_new ();
- gtk_container_add (GTK_CONTAINER (history_expander), m_history_text);
- gtk_box_pack_start (GTK_BOX (vbox), history_expander, FALSE, FALSE, 0);
-
-// g_signal_connect (G_OBJECT (vbox), "size-request",
-// G_CALLBACK (size_changed_cb), m_scrolled_window);
+ GtkWidget *notebook = gtk_notebook_new();
+ gtk_notebook_set_tab_pos (GTK_NOTEBOOK (notebook), GTK_POS_BOTTOM);
+ gtk_container_add (GTK_CONTAINER (m_widget), notebook);
+
+ m_about_text = add_text_tab (notebook, "Description");
+ m_filelist_text = add_text_tab (notebook, "File List");
+ m_history_text = add_text_tab (notebook, "History");
+ m_authors_text = add_text_tab (notebook, "Authors");
}
-
- gtk_widget_set_size_request (m_scrolled_window, -1, INFORMATION_HEIGHT);
+ gtk_widget_set_size_request (gtk_bin_get_child (GTK_BIN (m_widget)),
+ -1, INFORMATION_HEIGHT);
}
GtkWidget *getWidget()
@@ -310,52 +285,55 @@
void setPackage (ZyppSelectablePtr selectable, ZyppObject object)
{
- string description = "<i>(no package selected)</i>", file_list, history;
- if (selectable) {
- description = "<p><b>" + selectable->name() + "</b> - "
- + YGUtils::escape_markup (object->summary()) + "</p>"
-//FIXME: break authors nicely.
- + "<p>" + YGUtils::escape_markup (object->description()) + "</p>";
-
- if (m_filelist_text && m_history_text) {
- ZyppPackage package = tryCastToZyppPkg (object);
-
- const std::list <string> &filenames = package->filenames();
- for (std::list <string>::const_iterator it = filenames.begin();
- it != filenames.end(); it++)
- file_list += (*it) + "\n";
-
- const std::list zypp::ChangelogEntry &changelog = package->changelog();
- for (std::list zypp::ChangelogEntry::const_iterator it = changelog.begin();
- it != changelog.end(); it++)
- history += "<p><i>" + it->date().asString() + "</i> "
- "<b>" + it->author() + "</b></p>"
- "<p>" + it->text() + "</p>";
- }
- }
+ gtk_widget_set_sensitive (m_widget, TRUE);
- ygtk_richtext_set_text (YGTK_RICHTEXT (m_description_text),
- description.c_str(), FALSE, TRUE);
- if (m_filelist_text && m_history_text) {
- ygtk_richtext_set_text (YGTK_RICHTEXT (m_filelist_text),
- file_list.c_str(), TRUE, TRUE);
- ygtk_richtext_set_text (YGTK_RICHTEXT (m_history_text),
- history.c_str(), FALSE, TRUE);
+ if (m_about_text) {
+ string description = object->description();//YGUtils::escape_markup (object->description());
+ set_text (m_about_text, description);
+ // TODO: cut "Authors:" and following "-----" line to some authors string
+ }
+ ZyppPackage package = tryCastToZyppPkg (object);
+ if (m_filelist_text) {
+ string filelist;
+ const std::list <string> &filenames = package->filenames();
+ for (std::list <string>::const_iterator it = filenames.begin();
+ it != filenames.end(); it++)
+ filelist += (*it) + "\n";
+ set_text (m_filelist_text, filelist);
+ }
+ if (m_history_text) {
+ string history;
+ const std::list zypp::ChangelogEntry &changelog = package->changelog();
+ for (std::list zypp::ChangelogEntry::const_iterator it = changelog.begin();
+ it != changelog.end(); it++)
+ history += "<p><i>" + it->date().asString() + "</i> "
+ "<b>" + it->author() + "</b><br>" +
+ it->text() + "</p>";
+ set_text (m_history_text, history);
}
-
-// size_changed_cb (0, 0, m_scrolled_window);
}
- // This forces GtkScrolledWindow to set "new" scrollbars to reflect
- // a new box size (due to expanders being activated)
- // FIXME: ain't working all that well...
-/*
- static void size_changed_cb (GtkWidget *widget, GtkRequisition *requisition,
- GtkWidget *view)
- {
- gtk_scrolled_window_set_vadjustment (GTK_SCROLLED_WINDOW (view), NULL);
+ // auxiliaries to cut down on code
+ static GtkWidget *add_text_tab (GtkWidget *notebook, const char *label)
+ {
+ GtkWidget *widget, *scroll_win;
+ scroll_win = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll_win),
+ GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
+ widget = ygtk_richtext_new();
+ gtk_container_add (GTK_CONTAINER (scroll_win), widget);
+
+ gtk_notebook_append_page (GTK_NOTEBOOK (notebook), scroll_win,
+ gtk_label_new (label));
+ return widget;
+ }
+
+ static void set_text (GtkWidget *widget, const string &text)
+ {
+ GtkTextIter iter;
+ gtk_text_view_get_iter_at_location (GTK_TEXT_VIEW (widget), &iter, 0, 0);
+ ygtk_richtext_set_text (YGTK_RICHTEXT (widget), text.c_str(), FALSE, TRUE);
}
-*/
};
// YOU patch selector
@@ -1284,52 +1262,28 @@
return FALSE;
}
- static GtkWidget *please_wait_window()
- {
- GtkWidget *window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_title (GTK_WINDOW (window), "");
- gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
- gtk_window_set_transient_for (GTK_WINDOW (window), YGUI::ui()->currentWindow());
- gtk_window_set_modal (GTK_WINDOW (window), TRUE);
- gtk_window_set_type_hint (GTK_WINDOW (window), GDK_WINDOW_TYPE_HINT_DIALOG);
- GtkWidget *label = gtk_label_new ("Loading view...");
- gtk_container_add (GTK_CONTAINER (window), label);
- gtk_widget_realize (label);
- gtk_widget_show_all (window);
- // flush the window since there will be a long operation...
- while (gtk_events_pending())
- gtk_main_iteration();
- return window;
- }
-
// callbacks
static void view_plain_mode_cb (GtkToggleButton *button,
PackageSelector *pThis)
{
if (!gtk_toggle_button_get_active (button)) return;
- GtkWidget *wait_window = please_wait_window();
pThis->loadPackagesListAsPlain();
- gtk_widget_destroy (wait_window);
}
static void view_categories_mode_cb (GtkToggleButton *button,
PackageSelector *pThis)
{
if (!gtk_toggle_button_get_active (button)) return;
- GtkWidget *wait_window = please_wait_window();
pThis->clear_search_entry (true);
pThis->loadPackagesListByCategory();
- gtk_widget_destroy (wait_window);
}
static void view_patterns_mode_cb (GtkToggleButton *button,
PackageSelector *pThis)
{
if (!gtk_toggle_button_get_active (button)) return;
- GtkWidget *wait_window = please_wait_window();
pThis->clear_search_entry (true);
// pThis->loadPackagesListByPattern();
- gtk_widget_destroy (wait_window);
}
static void toggle_packages_view_cb (GtkToggleButton *button,
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-gtk-2.15.0/src/YGTable.cc new/yast2-gtk-2.15.1/src/YGTable.cc
--- old/yast2-gtk-2.15.0/src/YGTable.cc 2007-02-05 13:45:30.000000000 +0100
+++ new/yast2-gtk-2.15.1/src/YGTable.cc 2007-03-16 12:36:40.000000000 +0100
@@ -259,10 +259,6 @@
for (int i = 0; i < numCols(); i++)
insertColumn (i, headers[i], types[i]);
-#if GTK_CHECK_VERSION(2,10,0)
- gtk_tree_view_set_grid_lines (GTK_TREE_VIEW (getWidget()),
- GTK_TREE_VIEW_GRID_LINES_BOTH);
-#endif
setLabelVisible (false);
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-gtk-2.15.0/src/ygtkratiobox.c new/yast2-gtk-2.15.1/src/ygtkratiobox.c
--- old/yast2-gtk-2.15.0/src/ygtkratiobox.c 2007-02-05 13:45:30.000000000 +0100
+++ new/yast2-gtk-2.15.1/src/ygtkratiobox.c 2007-03-16 12:36:40.000000000 +0100
@@ -512,6 +512,11 @@
min_size->min_height = min_height;
}
+void ygtk_min_size_set_only_expand (YGtkMinSize *min_size, gboolean only_expand)
+{
+ min_size->only_expand = only_expand;
+}
+
void ygtk_min_size_size_request (GtkWidget *widget,
GtkRequisition *requisition)
{
@@ -526,6 +531,11 @@
YGtkMinSize *min_size = YGTK_MIN_SIZE (widget);
requisition->width = MAX (requisition->width, min_size->min_width);
requisition->height = MAX (requisition->height, min_size->min_height);
+
+ if (min_size->only_expand) {
+ min_size->min_width = requisition->width;
+ min_size->min_height = requisition->height;
+ }
}
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-gtk-2.15.0/src/ygtkratiobox.h new/yast2-gtk-2.15.1/src/ygtkratiobox.h
--- old/yast2-gtk-2.15.0/src/ygtkratiobox.h 2007-02-05 13:45:30.000000000 +0100
+++ new/yast2-gtk-2.15.1/src/ygtkratiobox.h 2007-03-16 12:36:40.000000000 +0100
@@ -181,6 +181,7 @@
GtkBin bin;
// members
guint min_width, min_height;
+ gboolean only_expand;
};
struct _YGtkMinSizeClass
@@ -194,5 +195,8 @@
void ygtk_min_size_set_width (YGtkMinSize *min_size, guint min_width);
void ygtk_min_size_set_height (YGtkMinSize *min_size, guint min_height);
+/* Only allow the child to ask for bigger sizes. */
+void ygtk_min_size_set_only_expand (YGtkMinSize *min_size, gboolean only_expand);
+
G_END_DECLS
#endif /*YGTK_MIN_SIZE_H*/
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-gtk-2.15.0/src/ygtkrichtext.c new/yast2-gtk-2.15.1/src/ygtkrichtext.c
--- old/yast2-gtk-2.15.0/src/ygtkrichtext.c 2007-02-05 13:45:30.000000000 +0100
+++ new/yast2-gtk-2.15.1/src/ygtkrichtext.c 2007-03-16 12:36:40.000000000 +0100
@@ -58,6 +58,7 @@
gtk_text_view_set_wrap_mode (tview, GTK_WRAP_WORD);
gtk_text_view_set_editable (tview, FALSE);
gtk_text_view_set_cursor_visible (tview, FALSE);
+ gtk_text_view_set_pixels_below_lines (tview, 6);
// Init link support
if (!ref_cursor) {
@@ -637,25 +638,39 @@
gdk_window_set_back_pixmap (window, pixmap, FALSE);
}
-static gboolean ygtk_richtext_advance_mark (YGtkRichText *rtext,
- GtkTextIter *start_iter, GtkTextIter *end_iter, const gchar *key)
+/* gtk_text_iter_forward_search() is case-sensitive so we roll our own.
+ The idea is to keep use get_text and strstr there, but to be more
+ efficient we check per line. */
+static gboolean ygtk_richtext_forward_search (const GtkTextIter *begin,
+ const GtkTextIter *end, const gchar *_key, GtkTextIter *match_start,
+ GtkTextIter *match_end)
{
- //return gtk_text_iter_forward_search (&iter, text, 0, start_iter, end_iter, NULL);
- // (This isn't case insensitive, so we will just roll our own search)
+ if (*_key == 0)
+ return FALSE;
- if (*key == '\0')
+ /* gtk_text_iter_get_char() returns a gunichar (ucs4 coding), so we
+ convert the given string (which is utf-8, like anyhting in gtk+) */
+ gunichar *key = g_utf8_to_ucs4 (_key, -1, NULL, NULL, NULL);
+ if (!key) // conversion error -- should not happen
return FALSE;
- const gchar *k;
- while (!gtk_text_iter_is_end (start_iter)) {
- *end_iter = *start_iter;
- for (k = key; (g_ascii_tolower (*k) ==
- g_ascii_tolower (gtk_text_iter_get_char (end_iter))) && (*k);
- k++, gtk_text_iter_forward_char (end_iter))
+ // convert key to lower case, to avoid work later
+ gunichar *k;
+ for (k = key; *k; k++)
+ *k = g_unichar_tolower (*k);
+
+ GtkTextIter iter = *begin, iiter;
+ while (!gtk_text_iter_is_end (&iter) && gtk_text_iter_compare (&iter, end) <= 0) {
+ iiter = iter;
+ for (k = key; *k == g_unichar_tolower (gtk_text_iter_get_char (&iiter)) && (*k);
+ k++, gtk_text_iter_forward_char (&iiter))
;
- if (!*k)
+ if (!*k) {
+ *match_start = iter;
+ *match_end = iiter;
return TRUE;
- gtk_text_iter_forward_char (start_iter);
+ }
+ gtk_text_iter_forward_char (&iter);
}
return FALSE;
}
@@ -663,22 +678,23 @@
gboolean ygtk_richtext_mark_text (YGtkRichText *rtext, const gchar *text)
{
GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (rtext));
- GtkTextIter start_iter, end_iter;
- gboolean found = FALSE;
+ GtkTextIter iter, end, match_start, match_end;
- gtk_text_buffer_get_bounds (buffer, &start_iter, &end_iter);
- gtk_text_buffer_remove_tag_by_name (buffer, "keyword", &start_iter, &end_iter);
+ gtk_text_buffer_get_bounds (buffer, &iter, &end);
+ gtk_text_buffer_remove_tag_by_name (buffer, "keyword", &iter, &end);
- gtk_text_buffer_select_range (buffer, &start_iter, &start_iter);
- if (*text == '\0')
+ gtk_text_buffer_select_range (buffer, &iter, &iter); // unselect text
+ if (!text || *text == '\0')
return TRUE;
- if (text)
- while (ygtk_richtext_advance_mark (rtext, &start_iter, &end_iter, text)) {
- found = TRUE;
- gtk_text_buffer_apply_tag_by_name (buffer, "keyword", &start_iter, &end_iter);
- start_iter = end_iter;
- }
+ gboolean found = FALSE;
+ while (ygtk_richtext_forward_search (&iter, &end, text,
+ &match_start, &match_end)) {
+ found = TRUE;
+ gtk_text_buffer_apply_tag_by_name (buffer, "keyword", &match_start, &match_end);
+ iter = match_end;
+ gtk_text_iter_forward_char (&iter);
+ }
return found;
}
@@ -688,12 +704,15 @@
GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (rtext));
gtk_text_buffer_get_iter_at_mark (buffer, &start_iter,
gtk_text_buffer_get_selection_bound (buffer));
+ gtk_text_buffer_get_end_iter (buffer, &end_iter);
gboolean found;
- found = ygtk_richtext_advance_mark (rtext, &start_iter, &end_iter, text);
+ found = ygtk_richtext_forward_search (&start_iter, &end_iter, text,
+ &start_iter, &end_iter);
if (!found) {
gtk_text_buffer_get_start_iter (buffer, &start_iter);
- found = ygtk_richtext_advance_mark (rtext, &start_iter, &end_iter, text);
+ found = ygtk_richtext_forward_search (&start_iter, &end_iter, text,
+ &start_iter, &end_iter);
}
if (found) {
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-gtk-2.15.0/src/ygtkwizard.c new/yast2-gtk-2.15.1/src/ygtkwizard.c
--- old/yast2-gtk-2.15.0/src/ygtkwizard.c 2007-02-05 13:45:30.000000000 +0100
+++ new/yast2-gtk-2.15.1/src/ygtkwizard.c 2007-03-16 12:36:40.000000000 +0100
@@ -179,7 +179,7 @@
return dialog;
}
-void ygtk_help_dialog_set_text (YGtkHelpDialog *dialog, const char *text)
+void ygtk_help_dialog_set_text (YGtkHelpDialog *dialog, const gchar *text)
{
gtk_editable_delete_text (GTK_EDITABLE (dialog->search_entry), 0, -1);
ygtk_richtext_set_text (YGTK_RICHTEXT (dialog->help_text), text, FALSE, FALSE);
@@ -205,7 +205,7 @@
gdk_beep();
}
gtk_widget_modify_base (dialog->search_entry, GTK_STATE_NORMAL, &background_clr);
- ygtk_richtext_forward_mark (YGTK_RICHTEXT (dialog->help_text), key);
+// ygtk_richtext_forward_mark (YGTK_RICHTEXT (dialog->help_text), key);
g_free (key);
}
@@ -519,7 +519,7 @@
/* Commands */
-void ygtk_wizard_set_help_text (YGtkWizard *wizard, const char *text)
+void ygtk_wizard_set_help_text (YGtkWizard *wizard, const gchar *text)
{
if (wizard->m_help)
g_free (wizard->m_help);
@@ -858,7 +858,7 @@
// title
gtk_widget_size_request (wizard->m_title, &req);
req.width += header_padding * 2 + border*2;
- req.height += header_padding;
+ req.height += header_padding * 2;
requisition->width = MAX (req.width, requisition->width);
requisition->height += req.height;
@@ -876,7 +876,7 @@
nav_req.width = nav_req.height = 0;
GtkWidget *child = GTK_BIN (wizard)->child;
- if (child)
+ if (child && GTK_WIDGET_VISIBLE (child))
gtk_widget_size_request (child, &child_req);
else
child_req.width = child_req.height = 0;
@@ -979,7 +979,7 @@
// child
GtkWidget *child = GTK_BIN (wizard)->child;
- if (child) {
+ if (child && GTK_WIDGET_VISIBLE (child)) {
apply_allocation_padding (&child_area, content_padding + CHILD_BORDER);
gtk_widget_size_allocate (child, &child_area);
}
@@ -1080,7 +1080,6 @@
ygtk_help_dialog_set_text (YGTK_HELP_DIALOG (wizard->m_help_dialog),
wizard->m_help);
}
-
gtk_widget_show (wizard->m_help_dialog);
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-gtk-2.15.0/src/ygtkwizard.h new/yast2-gtk-2.15.1/src/ygtkwizard.h
--- old/yast2-gtk-2.15.0/src/ygtkwizard.h 2007-02-05 13:45:30.000000000 +0100
+++ new/yast2-gtk-2.15.1/src/ygtkwizard.h 2007-03-16 12:36:40.000000000 +0100
@@ -121,7 +121,7 @@
// commands
// (commands that may fail return a sucess boolean.)
-void ygtk_wizard_set_help_text (YGtkWizard *wizard, const char *text);
+void ygtk_wizard_set_help_text (YGtkWizard *wizard, const gchar *text);
gboolean ygtk_wizard_add_tree_item (YGtkWizard *wizard, const char *parent_id,
const char *text, const char *id);
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-gtk-2.15.0/src/YGUI.cc new/yast2-gtk-2.15.1/src/YGUI.cc
--- old/yast2-gtk-2.15.0/src/YGUI.cc 2007-02-05 13:45:30.000000000 +0100
+++ new/yast2-gtk-2.15.1/src/YGUI.cc 2007-03-15 10:57:52.000000000 +0100
@@ -326,48 +326,64 @@
#include <sstream>
static YCPValue askForFileOrDirectory (GtkFileChooserAction action,
- const YCPString &startWith, const YCPString &filter_pattern,
- const YCPString &headline)
+ const YCPString &path, const YCPString &filter_pattern,
+ const YCPString &title)
{
+ IMPL
GtkWidget *dialog;
- dialog = gtk_file_chooser_dialog_new (headline->value_cstr(),
- YGUI::ui()->currentWindow(), action,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
+ dialog = gtk_file_chooser_dialog_new (title->value_cstr(),
+ YGUI::ui()->currentWindow(), action, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ action == GTK_FILE_CHOOSER_ACTION_SAVE ? GTK_STOCK_SAVE : GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
NULL);
+ gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (dialog), TRUE);
- // Yast gives startWith as an URL that can be a directory or a file
- // All this chunck of code is because GTK+ likes to get those
- // in separated.
- if (g_file_test (startWith->value_cstr(), G_FILE_TEST_EXISTS)) {
- if (action == GTK_FILE_CHOOSER_ACTION_OPEN ||
- action == GTK_FILE_CHOOSER_ACTION_SAVE) {
- if (g_file_test (startWith->value_cstr(), G_FILE_TEST_IS_DIR))
- gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog),
- startWith->value_cstr());
- else {
- string dirname, filename;
- YGUtils::splitPath (startWith->value(), dirname, filename);
- gtk_file_chooser_set_current_folder
- (GTK_FILE_CHOOSER (dialog),dirname.c_str());
- gtk_file_chooser_set_current_name
- (GTK_FILE_CHOOSER (dialog), filename.c_str());
- }
+ // Yast likes to pass the path and suggested filename as a whole. We will need to
+ // split that up for GTK+.
+ string dirpath (path->value()), filename;
+ if (!dirpath.empty()) {
+ string::size_type i;
+ // we don't support local paths
+ if (dirpath [0] != '/') {
+ filename = dirpath;
+ dirpath = "";
+ }
+ else if (!(g_file_test (dirpath.c_str(), G_FILE_TEST_IS_DIR))) {
+ i = dirpath.find_last_of ("/");
+ if (i == string::npos) {
+ filename = dirpath;
+ dirpath = "";
+ }
+ else {
+ string path (dirpath);
+ dirpath = path.substr (0, i+1);
+ filename = path.substr (i+1);
+ }
}
- else
- gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog),
- startWith->value_cstr());
- }
- else if (!startWith->value().empty() &&
- action == GTK_FILE_CHOOSER_ACTION_SAVE)
- gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog),
- startWith->value_cstr());
- if (action != GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER) {
+ // check if dirpath and filename are valid
+ if (!dirpath.empty())
+ if (!g_file_test (dirpath.c_str(), G_FILE_TEST_IS_DIR)) {
+ y2warning ("Path passed to file dialog isn't valid: '%s'", path->value_cstr());
+ dirpath = "";
+ }
+ i = filename.find ("/");
+ if (i != string::npos) {
+ y2warning ("Path passed to file dialog isn't valid: '%s'", path->value_cstr());
+ filename = "";
+ }
+ }
+
+ if (!dirpath.empty())
+ gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), dirpath.c_str());
+ if (!filename.empty())
+ gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog), filename.c_str());
+
+ string filter_str (filter_pattern->value());
+ if (filter_str != "" && filter_str != "*") {
GtkFileFilter *filter = gtk_file_filter_new();
- gtk_file_filter_set_name (filter, filter_pattern->value_cstr());
+ gtk_file_filter_set_name (filter, filter_str.c_str());
// cut filter_pattern into chuncks like GTK likes
- std::istringstream stream (filter_pattern->value());
+ std::istringstream stream (filter_str);
while (!stream.eof()) {
string str;
stream >> str;
@@ -378,7 +394,6 @@
gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
}
- YCPValue ret;
if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT) {
char* filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
YCPString ret (filename);
@@ -391,25 +406,26 @@
return YCPVoid();
}
-YCPValue YGUI::askForExistingDirectory (const YCPString &startDir,
- const YCPString &headline)
+YCPValue YGUI::askForExistingDirectory (const YCPString &path,
+ const YCPString &title)
{
- return askForFileOrDirectory (GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, startDir,
- YCPString ("*"), headline);
+ IMPL
+ return askForFileOrDirectory (GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, path,
+ YCPString (""), title);
}
-YCPValue YGUI::askForExistingFile (const YCPString &startWith,
- const YCPString &filter, const YCPString &headline)
+YCPValue YGUI::askForExistingFile (const YCPString &path,
+ const YCPString &filter, const YCPString &title)
{
- return askForFileOrDirectory (GTK_FILE_CHOOSER_ACTION_OPEN, startWith,
- filter, headline);
+ IMPL
+ return askForFileOrDirectory (GTK_FILE_CHOOSER_ACTION_OPEN, path, filter, title);
}
-YCPValue YGUI::askForSaveFileName (const YCPString &startWith,
- const YCPString &filter, const YCPString &headline)
+YCPValue YGUI::askForSaveFileName (const YCPString &path,
+ const YCPString &filter, const YCPString &title)
{
- return askForFileOrDirectory (GTK_FILE_CHOOSER_ACTION_SAVE, startWith,
- filter, headline);
+ IMPL
+ return askForFileOrDirectory (GTK_FILE_CHOOSER_ACTION_SAVE, path, filter, title);
}
bool YGUI::textMode() IMPL_RET(false)
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-gtk-2.15.0/src/YGUI.h new/yast2-gtk-2.15.1/src/YGUI.h
--- old/yast2-gtk-2.15.0/src/YGUI.h 2007-02-06 18:54:23.000000000 +0100
+++ new/yast2-gtk-2.15.1/src/YGUI.h 2007-03-16 13:06:43.000000000 +0100
@@ -12,7 +12,7 @@
using std::vector;
/* Comment the following line to disable debug messages */
-//#define IMPL_DEBUG
+// #define IMPL_DEBUG
#define LOC fprintf (stderr, "%s (%s)\n", G_STRLOC, G_STRFUNC)
#ifdef IMPL_DEBUG
#define IMPL { LOC; }
@@ -69,7 +69,7 @@
virtual YContainerWidget *createRadioButtonGroup (YWidget *parent, YWidgetOpt &opt);
virtual YContainerWidget *createFrame (YWidget *parent, YWidgetOpt &opt,
const YCPString &label);
-#if YAST2_VERSION >= 2014000
+#if YAST2_VERSION > 2014004 || YAST2_VERSION > 2013032
virtual YContainerWidget *createCheckBoxFrame( YWidget *parent, YWidgetOpt & opt, const YCPString & label, bool checked );
#endif
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-gtk-2.15.0/src/YGUtils.cc new/yast2-gtk-2.15.1/src/YGUtils.cc
--- old/yast2-gtk-2.15.0/src/YGUtils.cc 2007-02-05 13:45:30.000000000 +0100
+++ new/yast2-gtk-2.15.1/src/YGUtils.cc 2007-03-16 13:19:36.000000000 +0100
@@ -5,22 +5,18 @@
#include
#include "YGUtils.h"
-string YGUtils::mapKBAccel(const char *src)
+void YGUtils::replace (std::string &str, char from, char to)
{
- string str;
- int length = strlen (src);
-
- str.reserve (length);
- for (int i = 0; i < length; i++) {
- if (src[i] == '_')
- str += "__";
- else if (src[i] == '&')
- str += '_';
- else
- str += src[i];
- }
+ for (unsigned int i = 0; i < str.length(); i++)
+ if (str [i] == from)
+ str [i] = to;
+}
- return str;
+string YGUtils::mapKBAccel (const char *src)
+{
+ string dst (src);
+ replace (dst, '&', '_');
+ return dst;
}
string YGUtils::filterText (const char* text, int length, const char *valid_chars)
@@ -344,8 +340,8 @@
int size = pango_font_description_get_size (font_desc);
PangoFontDescription* font = pango_font_description_new();
- pango_font_description_set_weight (font, PANGO_WEIGHT_ULTRABOLD);
- pango_font_description_set_size (font, (int)(size * PANGO_SCALE_XX_LARGE));
+ pango_font_description_set_weight (font, weight);
+ pango_font_description_set_size (font, (int)(size * scale));
gtk_widget_modify_font (widget, font);
pango_font_description_free (font);
@@ -407,19 +403,6 @@
return false;
}
-void YGUtils::splitPath (const string &path, string &dirname, string &filename)
-{
- string::size_type i = path.find_last_of ("/");
- if (i == string::npos) {
- dirname = path;
- filename = "";
- }
- else {
- dirname = path.substr (0, i);
- filename = path.substr (i+1);
- }
-}
-
std::list <string> YGUtils::splitString (const string &str, char separator)
{
std::list <string> parts;
@@ -578,3 +561,14 @@
g_value_set_float (&value, num);
return value;
}
+
+void YGUtils::setLabel (GtkLabel *widget, const YCPString &label, bool bold)
+{
+ string str;
+ if (bold)
+ str = "<b>" + label->value() + "</b>";
+ else
+ str = label->value();
+ str = YGUtils::mapKBAccel(str.c_str());
+ gtk_label_set_markup_with_mnemonic (widget, str.c_str());
+}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-gtk-2.15.0/src/YGUtils.h new/yast2-gtk-2.15.1/src/YGUtils.h
--- old/yast2-gtk-2.15.0/src/YGUtils.h 2007-02-05 13:45:30.000000000 +0100
+++ new/yast2-gtk-2.15.1/src/YGUtils.h 2007-03-16 13:19:42.000000000 +0100
@@ -14,8 +14,16 @@
namespace YGUtils
{
- /* Replaces '&' accelerator like Yast likes by the '_' that Gnome prefers. */
- string mapKBAccel(const char *src);
+ /* Replaces all characters 'from' by characters 'to' on the string passed. */
+ void replace (std::string &str, char from, char to);
+
+ /* Convinience function, from the above. Replaces '&' accelerator like Yast
+ likes by the '_' that Gnome prefers. */
+ string mapKBAccel (const char *src);
+
+ /* Set a label to the contents of this string, with suitable
+ accelerator / mnemonic translation etc. */
+ void setLabel (GtkLabel *widget, const YCPString &label, bool bold = true);
/* Filters characters that are not on the valids_chars array from the text string
Length is used to tell the length of text, in case it isn't NUL
@@ -48,10 +56,6 @@
/* Checks if a std::string contains some other string (case insensitive). */
bool contains (const string &haystack, const string &needle);
- /* Splits a path to a filename by the path expect the file that is
- then written to filename. */
- void splitPath (const string &path, string &dirname, string &filename);
-
/* Splits a string into parts as separated by the separator characters.
eg: splitString ("Office/Writer", '/') => { "Office", "Writer" } */
std::list <string> splitString (const string &str, char separator);
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-gtk-2.15.0/src/YGWidget.cc new/yast2-gtk-2.15.1/src/YGWidget.cc
--- old/yast2-gtk-2.15.0/src/YGWidget.cc 2007-02-05 13:45:30.000000000 +0100
+++ new/yast2-gtk-2.15.1/src/YGWidget.cc 2007-03-16 12:36:40.000000000 +0100
@@ -133,12 +133,21 @@
/* Checks everywhere in a container to see if there are children (so
he is completely initialized) so that we may ask him for stretchable()
because some YContainerWidgets crash when they don't have children. */
+#include "YSplit.h"
static bool safe_stretchable (YWidget *widget)
{
YContainerWidget *container = dynamic_cast (widget);
if (container) {
- if (!container->hasChildren())
- return false;
+ YSplit *split = dynamic_cast (widget);
+ // in the case of YSplit its safe to ask for stretchability with no kids
+ if (split) {
+ if (!split->hasChildren())
+ return true;
+ }
+ else
+ if (!container->hasChildren())
+ return false;
+
for (int i = 0; i < container->numChildren(); i++)
if (!safe_stretchable (container->child (i)))
return false;
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-gtk-2.15.0/src/YGWizard.cc new/yast2-gtk-2.15.1/src/YGWizard.cc
--- old/yast2-gtk-2.15.0/src/YGWizard.cc 2007-02-05 13:45:30.000000000 +0100
+++ new/yast2-gtk-2.15.1/src/YGWizard.cc 2007-03-15 10:57:52.000000000 +0100
@@ -34,14 +34,19 @@
// crash otherwise (stretchable() functions should really check for
// hasChildren() first!).
- YWidgetOpt opt;
- YWidget *rp, *empty;
- rp = YGUI::ui()->createReplacePoint (this, opt);
+ YWidgetOpt opt, stretchOpt;
+ stretchOpt.isHStretchable.setValue( true );
+ stretchOpt.isVStretchable.setValue( true );
+
+ YWidget *align, *rp, *empty;
+ align = YGUI::ui()->createAlignment (this, stretchOpt, YAlignCenter, YAlignCenter);
+ rp = YGUI::ui()->createReplacePoint (align, opt);
rp->setId (YCPSymbol (YWizardContentsReplacePointID));
empty = YGUI::ui()->createEmpty (rp, opt);
+ ((YContainerWidget *) align)->addChild (rp);
((YContainerWidget *) rp)->addChild (empty);
- this->addChild (rp);
+ this->addChild (align);
}
YGtkWizard *ygtk_wizard = YGTK_WIZARD (getWidget());
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-gtk-2.15.0/TODO new/yast2-gtk-2.15.1/TODO
--- old/yast2-gtk-2.15.0/TODO 2007-02-06 18:09:11.000000000 +0100
+++ new/yast2-gtk-2.15.1/TODO 2007-03-15 10:57:53.000000000 +0100
@@ -2,6 +2,9 @@
= Look and feel =
+* Layout (tests/Layout-Split-Split.ycp)
+ Center stuff on wizards.
+
* BarGraph / RatioBox
Let tiny widgets still have some pixels visible for popup menu.
@@ -43,12 +46,6 @@
Probably a tab for this?
* Others
- + sometimes scrollbars are not presented on the package information.
- We already do some work arounds so that GtkScrolledWindow scrollbars are
- recalculated when an expander is pressed (it, or the GtkViewPort, inside
- doesn't seem to deal well with dynamic containers), but there is some weird
- case still to fix...
-
* we should let user see disk usage. Unlike yast-qt, which displays it on
its entirely, maybe we could have use a combo box and only display the
size used for that partition. Or maybe use an expander.
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-gtk-2.15.0/VERSION new/yast2-gtk-2.15.1/VERSION
--- old/yast2-gtk-2.15.0/VERSION 2007-02-07 11:17:01.000000000 +0100
+++ new/yast2-gtk-2.15.1/VERSION 2007-03-16 13:35:41.000000000 +0100
@@ -1 +1 @@
-2.15.0
+2.15.1
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
---------------------------------------------------------------------
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org