Mailing Lists
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2023
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
List overview
Download
YaST Commits
June 2008
----- 2023 -----
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
yast-commit@lists.opensuse.org
27 participants
711 discussions
Start a n
N
ew thread
[yast-commit] r47997 - in /trunk/backup: package/yast2-backup.changes src/functions.ycp src/ui.ycp
by locilka@svn.opensuse.org
02 Jun '08
02 Jun '08
Author: locilka Date: Mon Jun 2 18:20:08 2008 New Revision: 47997 URL:
http://svn.opensuse.org/viewcvs/yast?rev=47997&view=rev
Log: - TextEntry items replaced with InputField items. - Checking existence of directory included for backup (bnc #395835) - Added Browse button for selecting the filename to store the backup to. - Added confirmation dialog before removing dierctory included for backup. Modified: trunk/backup/package/yast2-backup.changes trunk/backup/src/functions.ycp trunk/backup/src/ui.ycp Modified: trunk/backup/package/yast2-backup.changes URL:
http://svn.opensuse.org/viewcvs/yast/trunk/backup/package/yast2-backup.chan…
============================================================================== --- trunk/backup/package/yast2-backup.changes (original) +++ trunk/backup/package/yast2-backup.changes Mon Jun 2 18:20:08 2008 @@ -1,4 +1,14 @@ ------------------------------------------------------------------- +Mon Jun 2 18:07:34 CEST 2008 - locilka(a)suse.cz + +- TextEntry items replaced with InputField items. +- Checking existence of directory included for backup (bnc #395835) +- Added Browse button for selecting the filename to store the + backup to. +- Added confirmation dialog before removing dierctory included for + backup. + +------------------------------------------------------------------- Mon May 19 09:43:11 CEST 2008 - locilka(a)suse.cz - Replacing Wizard::SetFocusToNextButton with UI::SetFocus which Modified: trunk/backup/src/functions.ycp URL:
http://svn.opensuse.org/viewcvs/yast/trunk/backup/src/functions.ycp?rev=479…
============================================================================== --- trunk/backup/src/functions.ycp (original) +++ trunk/backup/src/functions.ycp Mon Jun 2 18:20:08 2008 @@ -104,7 +104,7 @@ ((size(combo_content) > 0) ? `ComboBox(`id(`te), `opt(`hstretch, `editable), label, combo_content) : - `TextEntry(`id(`te), label, value) + `InputField (`id (`te), `opt (`hstretch), label, value) ), `VSpacing(1.0), `HBox( @@ -137,7 +137,7 @@ UI::OpenDialog( `VBox( `HBox ( - `TextEntry(`id(`te), label, value), + `InputField (`id (`te), `opt (`hstretch), label, value), `HSpacing(1.0), `VBox ( `VSpacing(0.9), Modified: trunk/backup/src/ui.ycp URL:
http://svn.opensuse.org/viewcvs/yast/trunk/backup/src/ui.ycp?rev=47997&r1=4…
============================================================================== --- trunk/backup/src/ui.ycp (original) +++ trunk/backup/src/ui.ycp Mon Jun 2 18:20:08 2008 @@ -27,6 +27,8 @@ import "Nfs"; import "PackageSystem"; import "Popup"; +import "Confirm"; +import "Mode"; include "backup/help_texts.ycp"; include "backup/functions.ycp"; @@ -713,7 +715,14 @@ Wizard::SetContents(_("Archive Settings"), `VBox( `VSpacing(0.5), - `TextEntry(`id(`filename), Label::FileName()), + `HBox ( + `InputField (`id (`filename), `opt (`hstretch), Label::FileName()), + `HSpacing(1), + `VBox ( + `Label (""), + `PushButton (`id(`browse_file), Label::BrowseButton()) + ) + ), `VSpacing(0.5), `Frame(_("Backup Location"), @@ -729,7 +738,7 @@ `HBox( `HSpacing(2), // text entry label - `TextEntry(`id(`nfsserver), _("I&P Address or Name of NFS Server"), Backup::nfsserver), + `InputField (`id (`nfsserver), `opt (`hstretch), _("I&P Address or Name of NFS Server"), Backup::nfsserver), `HSpacing(1), // push button label `VBox( @@ -741,7 +750,7 @@ `HBox( `HSpacing(2), // text entry label - `TextEntry(`id(`nfsexport), _("&Remote Directory"), Backup::nfsexport), + `InputField (`id (`nfsexport), `opt (`hstretch), _("&Remote Directory"), Backup::nfsexport), `HSpacing(1), // push button label `VBox( @@ -841,10 +850,20 @@ while (!cont) { + ret = (symbol) UI::UserInput(); + + if (ret == `browse_file) { + // TRANSLATORS: explanatory headline for UI::AskForExistingFile pop-up + string new_filename = UI::AskForExistingFile("", "", _("Where would you like to store the backup?")); + if (new_filename != nil && new_filename != "") { + UI::ChangeWidget (`id(`filename), `Value, new_filename); + } + continue; + } + // update dialog (enable/disable widgets) update_location_dialog(); - ret = (symbol)UI::UserInput(); Backup::nfsserver = (string)UI::QueryWidget(`id(`nfsserver), `Value); Backup::nfsexport = (string)UI::QueryWidget(`id(`nfsexport), `Value); @@ -1100,7 +1119,7 @@ `Left( `HBox( // text entry label - `TextEntry(`id(`user_size), _("Custom &Size")), + `InputField (`id (`user_size), `opt (`hstretch), _("Custom &Size")), `ComboBox(`id(`user_unit), "", description_combo_units), `HStretch() ) @@ -3242,7 +3261,7 @@ ), `VSpacing(1.0), // text entry label - `TextEntry(`id(`tmp), `opt(`hstretch), _("&Temporary Location of Archive Parts"), Backup::tmp_dir), + `InputField (`id (`tmp), `opt(`hstretch), _("&Temporary Location of Archive Parts"), Backup::tmp_dir), `VSpacing(0.5) ), expert_options_help(), true, true @@ -3520,7 +3539,7 @@ `VSpacing(0.5), `HBox( `HSpacing(1.0), - `TextEntry(`id(`dir), label, dir), + `InputField (`id(`dir), `opt (`vstretch), label, dir), `HSpacing(1), `VBox( `Label(""), @@ -3799,7 +3818,7 @@ `VSquash( `MinHeight(6, // selection box - `SelectionBox(`id(`include), `opt(`shrinkable), _("Directories Included in Search"), []) + `SelectionBox(`id(`include), `opt(`shrinkable), _("&Directories Included in Search"), []) ) ), `HBox( @@ -3975,7 +3994,7 @@ if (regexpmatch(new_dir, "^.+/$")) { new_dir = regexpsub(new_dir, "^(.+)/$", "\\1"); } - + if (new_dir == Backup::default_include_dir) { y2milestone("Selecting the whole fs '/'"); Backup::include_dirs = [Backup::default_include_dir]; @@ -3986,18 +4005,35 @@ } void AddIncludeItem () { - // return $[ "text" : text, "clicked" : input ]; - map <string, any> new_dir = ShowEditBrowseDialog(_("&Add New Directory"), ""); + while (true) { + // return $[ "text" : text, "clicked" : input ]; + map <string, any> new_dir = ShowEditBrowseDialog(_("&Add New Directory"), ""); + + if (new_dir["clicked"]:nil == `ok && new_dir["text"]:"" != "" && new_dir["text"]:nil != nil) { + // bnc #395835 + if (Mode::normal() && ! FileUtils::Exists (new_dir["text"]:"") && (! Popup::AnyQuestion ( + _("Warning"), + sformat (_("Directory %1 does not exist. + +Use it anyway?"), new_dir["text"]:""), + _("Yes, Use It"), + Label::NoButton(), + `focus_yes + ))) { + continue; + } - if (new_dir["clicked"]:nil == `ok && new_dir["text"]:"" != "" && new_dir["text"]:nil != nil) { - AddIncludeItemNow(new_dir["text"]:""); + AddIncludeItemNow(new_dir["text"]:""); - RedrawIncludeTable(); + RedrawIncludeTable(); + } + + break; } } void DeleteIncludeItem (string delete_dir) { - if (contains(Backup::include_dirs, delete_dir)) { + if (Confirm::DeleteSelected() && contains(Backup::include_dirs, delete_dir)) { Backup::include_dirs = filter (string one_dir, Backup::include_dirs, { return one_dir != delete_dir; }); -- To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
0
0
[yast-commit] r47996 - in /trunk/gtk: ChangeLog src/YGUI.cc
by rpmcruz@svn.opensuse.org
02 Jun '08
02 Jun '08
Author: rpmcruz Date: Mon Jun 2 17:30:45 2008 New Revision: 47996 URL:
http://svn.opensuse.org/viewcvs/yast?rev=47996&view=rev
Log: * src/YGUI.cc: fixed bug 395484. Wrong check that assumed error was set, crashing... Modified: trunk/gtk/ChangeLog trunk/gtk/src/YGUI.cc Modified: trunk/gtk/ChangeLog URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/ChangeLog?rev=47996&r1=47995…
============================================================================== --- trunk/gtk/ChangeLog (original) +++ trunk/gtk/ChangeLog Mon Jun 2 17:30:45 2008 @@ -24,6 +24,9 @@ * src/ygtkwizard.c: let the side pane shrink. + * src/YGUI.cc: fixed bug 395484. Wrong check that assumed error + was set, crashing... + 2008-05-28 Ricardo Cruz <rpmcruz(a)alunos.dcc.fc.up.pt> * src/YGDialog.cc: bug fix: seems like we shouldn't unref the Modified: trunk/gtk/src/YGUI.cc URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGUI.cc?rev=47996&r1=479…
============================================================================== --- trunk/gtk/src/YGUI.cc (original) +++ trunk/gtk/src/YGUI.cc Mon Jun 2 17:30:45 2008 @@ -389,13 +389,15 @@ } yuiDebug() << "Saving screen shot to " << filename << endl; - if (gdk_pixbuf_save (shot, filename.c_str(), "png", &error, NULL)) { - yuiError() << "Couldn't save screen shot " << filename << endl; - if (interactive) { - string msg = _("Couldn't save screenshot to file ") + filename - + " - " + error->message; - errorMsg (msg.c_str()); + if (!gdk_pixbuf_save (shot, filename.c_str(), "png", &error, NULL)) { + string msg = _("Couldn't save screenshot to file ") + filename; + if (error) { + msg += "\n"; + msg += std::string ("\n") + error->message; } + yuiError() << msg << endl; + if (interactive) + errorMsg (msg.c_str()); goto makeScreenShot_ret; } -- To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
0
0
[yast-commit] r47995 - in /trunk/gtk: ChangeLog src/YGUI.cc src/YGi18n.h src/ygtkwizard.c
by michael_meeks@svn.opensuse.org
02 Jun '08
02 Jun '08
Author: michael_meeks Date: Mon Jun 2 17:26:08 2008 New Revision: 47995 URL:
http://svn.opensuse.org/viewcvs/yast?rev=47995&view=rev
Log: 2008-06-02 Michael Meeks <michael.meeks(a)novell.com> * src/YGUI.cc (YGApplication::makeScreenShot), * src/ygtkwizard.c (ygtk_help_dialog_init), * src/ygtkwizard.c (sync_window_title): tag more missing strings for translation in the next version bug #395803# Modified: trunk/gtk/ChangeLog trunk/gtk/src/YGUI.cc trunk/gtk/src/YGi18n.h trunk/gtk/src/ygtkwizard.c Modified: trunk/gtk/ChangeLog URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/ChangeLog?rev=47995&r1=47994…
============================================================================== --- trunk/gtk/ChangeLog (original) +++ trunk/gtk/ChangeLog Mon Jun 2 17:26:08 2008 @@ -1,3 +1,10 @@ +2008-06-02 Michael Meeks <michael.meeks(a)novell.com> + + * src/YGUI.cc (YGApplication::makeScreenShot), + * src/ygtkwizard.c (ygtk_help_dialog_init), + * src/ygtkwizard.c (sync_window_title): tag more missing + strings for translation in the next version bug #395803# + 2008-06-02 Ricardo Cruz <rpmcruz(a)alunos.dcc.fc.up.pt> * src/YGWidget.h/cc & src/YGLayout.h/cc: now using libyui for Modified: trunk/gtk/src/YGUI.cc URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGUI.cc?rev=47995&r1=479…
============================================================================== --- trunk/gtk/src/YGUI.cc (original) +++ trunk/gtk/src/YGUI.cc Mon Jun 2 17:26:08 2008 @@ -325,7 +325,7 @@ GtkWidget *widget = GTK_WIDGET (YGDialog::currentWindow()); if (!widget) { if (interactive) - errorMsg ("No dialog to take screenshot of."); + errorMsg (_("No dialog to take screenshot of.")); return; } @@ -337,7 +337,7 @@ if (!shot) { if (interactive) - errorMsg ("Couldn't take a screenshot."); + errorMsg (_("Couldn't take a screenshot.")); return; } @@ -392,7 +392,7 @@ if (gdk_pixbuf_save (shot, filename.c_str(), "png", &error, NULL)) { yuiError() << "Couldn't save screen shot " << filename << endl; if (interactive) { - string msg = "Couldn't save screenshot to file " + filename + string msg = _("Couldn't save screenshot to file ") + filename + " - " + error->message; errorMsg (msg.c_str()); } Modified: trunk/gtk/src/YGi18n.h URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGi18n.h?rev=47995&r1=47…
============================================================================== --- trunk/gtk/src/YGi18n.h (original) +++ trunk/gtk/src/YGi18n.h Mon Jun 2 17:26:08 2008 @@ -25,15 +25,16 @@ #define TEXTDOMAIN "yast2-gtk" -inline const char * _( const char * msgid ) +static inline const char * _( const char * msgid ) { return ( !msgid || !*msgid ) ? "" : dgettext( TEXTDOMAIN, msgid ); } -inline const char * _( const char * msgid1, const char * msgid2, unsigned long int n ) +#ifndef YGI18N_C +static inline const char * _( const char * msgid1, const char * msgid2, unsigned long int n ) { return dngettext( TEXTDOMAIN, msgid1, msgid2, n ); } - +#endif #endif // YGi18n_h Modified: trunk/gtk/src/ygtkwizard.c URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkwizard.c?rev=47995&r…
============================================================================== --- trunk/gtk/src/ygtkwizard.c (original) +++ trunk/gtk/src/ygtkwizard.c Mon Jun 2 17:26:08 2008 @@ -14,6 +14,8 @@ #include "ygtkhtmlwrap.h" #include "ygtksteps.h" #include "ygtkfindentry.h" +#define YGI18N_C +#include "YGi18n.h" #define BUTTONS_SPACING 12 #define BORDER 4 @@ -75,7 +77,7 @@ gtk_window_set_type_hint (GTK_WINDOW (dialog), GDK_WINDOW_TYPE_HINT_DIALOG); - gtk_window_set_title (GTK_WINDOW (dialog), "Help"); + gtk_window_set_title (GTK_WINDOW (dialog), _("Help")); gtk_window_set_default_size (GTK_WINDOW (dialog), 400, 350); // title @@ -86,7 +88,7 @@ gtk_container_set_border_width (GTK_CONTAINER (dialog->title_box), 6); dialog->title_image = gtk_image_new_from_stock (GTK_STOCK_HELP, GTK_ICON_SIZE_LARGE_TOOLBAR); - dialog->title_label = gtk_label_new ("Help"); + dialog->title_label = gtk_label_new (_("Help")); set_label_header (dialog->title_label, 0); gtk_box_pack_start (GTK_BOX (dialog->title_box), dialog->title_image, FALSE, FALSE, 0); @@ -613,9 +615,9 @@ const gchar *_title = gtk_label_get_text (GTK_LABEL (wizard->m_title_label)); char *title; if (*_title == '\0') - title = g_strdup ("YaST"); + title = g_strdup (_("YaST")); else - title = g_strdup_printf ("%s - YaST", _title); + title = g_strdup_printf (_("%s - YaST"), _title); GdkPixbuf *pixbuf = gtk_image_get_pixbuf (GTK_IMAGE (wizard->m_title_image)); gtk_window_set_title (GTK_WINDOW (window), title); -- To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
0
0
[yast-commit] r47994 - /trunk/ncurses-pkg/src/NCPkgFilterRepo.cc
by kmachalkova@svn.opensuse.org
02 Jun '08
02 Jun '08
Author: kmachalkova Date: Mon Jun 2 17:15:42 2008 New Revision: 47994 URL:
http://svn.opensuse.org/viewcvs/yast?rev=47994&view=rev
Log: restrict this to packages Modified: trunk/ncurses-pkg/src/NCPkgFilterRepo.cc Modified: trunk/ncurses-pkg/src/NCPkgFilterRepo.cc URL:
http://svn.opensuse.org/viewcvs/yast/trunk/ncurses-pkg/src/NCPkgFilterRepo.…
============================================================================== --- trunk/ncurses-pkg/src/NCPkgFilterRepo.cc (original) +++ trunk/ncurses-pkg/src/NCPkgFilterRepo.cc Mon Jun 2 17:15:42 2008 @@ -221,6 +221,7 @@ zypp::PoolQuery q; q.addRepo( repo.info().alias() ); + q.addKind( zypp::ResKind::package ); for( zypp::PoolQuery::Selectable_iterator it = q.selectableBegin(); it != q.selectableEnd(); it++) -- To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
0
0
[yast-commit] r47993 - in /trunk/gtk: ChangeLog src/YGComboBox.cc src/YGFrame.cc src/YGWidget.cc src/ygtkwizard.c
by rpmcruz@svn.opensuse.org
02 Jun '08
02 Jun '08
Author: rpmcruz Date: Mon Jun 2 16:56:17 2008 New Revision: 47993 URL:
http://svn.opensuse.org/viewcvs/yast?rev=47993&view=rev
Log: * src/YGComboBox.cc: fixed bug 394309: GTK returning null for active text. * src/YGWidget.cc (doSetEnabled): also disable the label, to give a better look. * src/ygtkwizard.c: let the side pane shrink. Modified: trunk/gtk/ChangeLog trunk/gtk/src/YGComboBox.cc trunk/gtk/src/YGFrame.cc trunk/gtk/src/YGWidget.cc trunk/gtk/src/ygtkwizard.c Modified: trunk/gtk/ChangeLog URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/ChangeLog?rev=47993&r1=47992…
============================================================================== --- trunk/gtk/ChangeLog (original) +++ trunk/gtk/ChangeLog Mon Jun 2 16:56:17 2008 @@ -9,6 +9,14 @@ * src/ygtkratiobox.h/.c: simplified it. + * src/YGComboBox.cc: fixed bug 394309: GTK returning null for + active text. + + * src/YGWidget.cc (doSetEnabled): also disable the label, to + give a better look. + + * src/ygtkwizard.c: let the side pane shrink. + 2008-05-28 Ricardo Cruz <rpmcruz(a)alunos.dcc.fc.up.pt> * src/YGDialog.cc: bug fix: seems like we shouldn't unref the Modified: trunk/gtk/src/YGComboBox.cc URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGComboBox.cc?rev=47993&…
============================================================================== --- trunk/gtk/src/YGComboBox.cc (original) +++ trunk/gtk/src/YGComboBox.cc Mon Jun 2 16:56:17 2008 @@ -65,7 +65,12 @@ virtual string text() { - return gtk_combo_box_get_active_text (getComboBox()); + gchar *str = gtk_combo_box_get_active_text (getComboBox()); + std::string ret; + if (str) + ret = str; + g_free (str); + return ret; } virtual void setText (const string &value) Modified: trunk/gtk/src/YGFrame.cc URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGFrame.cc?rev=47993&r1=…
============================================================================== --- trunk/gtk/src/YGFrame.cc (original) +++ trunk/gtk/src/YGFrame.cc Mon Jun 2 16:56:17 2008 @@ -9,7 +9,7 @@ // Instead of traditional looking frames, we use Gnome convention for the // frame's look. That is: don't draw a frame, use bold header and pad the child. -#define CHILD_INDENTATION 15 +#define CHILD_INDENTATION 20 class YGBaseFrame : public YGWidget { @@ -24,7 +24,8 @@ { IMPL m_containee = gtk_alignment_new (0, 0, 1, 1); - gtk_alignment_set_padding (GTK_ALIGNMENT (m_containee), 0, 0, 15, 0); + gtk_alignment_set_padding (GTK_ALIGNMENT (m_containee), + 0, 0, CHILD_INDENTATION, 0); gtk_widget_show (m_containee); gtk_container_add (GTK_CONTAINER (getWidget()), m_containee); } @@ -101,7 +102,7 @@ YGWIDGET_IMPL_COMMON YGWIDGET_IMPL_CHILD_ADDED (m_containee) - YGWIDGET_IMPL_CHILD_REMOVED (getWidget()) + YGWIDGET_IMPL_CHILD_REMOVED (m_containee) }; @@ -122,7 +123,7 @@ { IMPL GtkWidget *button = gtk_check_button_new_with_mnemonic(""); - YGUtils::setWidgetFont (GTK_WIDGET (button), PANGO_WEIGHT_BOLD, + YGUtils::setWidgetFont (gtk_bin_get_child (GTK_BIN (button)), PANGO_WEIGHT_BOLD, PANGO_SCALE_MEDIUM); gtk_widget_show_all (button); gtk_frame_set_label_widget (GTK_FRAME (getWidget()), button); @@ -157,9 +158,8 @@ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), value); } - virtual void setEnabled (bool enabled) - { - + virtual void doSetEnabled (bool enabled) + { GtkWidget *frame = getWidget(); if (enabled) { gtk_widget_set_sensitive (frame, TRUE); @@ -172,8 +172,9 @@ YWidget::setEnabled (enabled); } + YGWIDGET_IMPL_COMMON YGWIDGET_IMPL_CHILD_ADDED (m_containee) - YGWIDGET_IMPL_CHILD_REMOVED (getWidget()) + YGWIDGET_IMPL_CHILD_REMOVED (m_containee) private: static void toggled_cb (GtkWidget *widget, YGCheckBoxFrame *pThis) Modified: trunk/gtk/src/YGWidget.cc URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGWidget.cc?rev=47993&r1…
============================================================================== --- trunk/gtk/src/YGWidget.cc (original) +++ trunk/gtk/src/YGWidget.cc Mon Jun 2 16:56:17 2008 @@ -83,7 +83,7 @@ void YGWidget::doSetEnabled (bool enabled) { - gtk_widget_set_sensitive (getWidget(), enabled); + gtk_widget_set_sensitive (getLayout(), enabled); } void YGWidget::doSetUseBoldFont (bool useBold) Modified: trunk/gtk/src/ygtkwizard.c URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkwizard.c?rev=47993&r…
============================================================================== --- trunk/gtk/src/ygtkwizard.c (original) +++ trunk/gtk/src/ygtkwizard.c Mon Jun 2 16:56:17 2008 @@ -490,7 +490,7 @@ GtkWidget *child = wizard->m_child, *pane; pane = gtk_hpaned_new(); - gtk_paned_pack1 (GTK_PANED (pane), wizard->m_tree, TRUE, FALSE); + gtk_paned_pack1 (GTK_PANED (pane), wizard->m_tree, TRUE, TRUE); gtk_widget_show_all (pane); ygtk_wizard_set_child (wizard, pane); wizard->m_pane = pane; -- To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
0
0
[yast-commit] r47992 - in /trunk/gtk: ./ src/
by rpmcruz@svn.opensuse.org
02 Jun '08
02 Jun '08
Author: rpmcruz Date: Mon Jun 2 16:25:02 2008 New Revision: 47992 URL:
http://svn.opensuse.org/viewcvs/yast?rev=47992&view=rev
Log: * src/YGWidget.h/cc & src/YGLayout.h/cc: now using libyui for the layout to avoid bugs and stuff. It's inter-laced with GTK, so we can keep our simplified containers like the dumbtab. * src/ygtkfixed.h/.c: added this container that makes life easier for YGLayoutBox and others. * src/ygtkratiobox.h/.c: simplified it. Added: trunk/gtk/src/ygtkfixed.c trunk/gtk/src/ygtkfixed.h Modified: trunk/gtk/ChangeLog trunk/gtk/src/Makefile.am trunk/gtk/src/YGBarGraph.cc trunk/gtk/src/YGDialog.cc trunk/gtk/src/YGDialog.h trunk/gtk/src/YGLabel.cc trunk/gtk/src/YGLayout.cc trunk/gtk/src/YGProgressBar.cc trunk/gtk/src/YGUI.cc trunk/gtk/src/YGUI.h trunk/gtk/src/YGWidget.cc trunk/gtk/src/YGWidget.h trunk/gtk/src/ygtkbargraph.c trunk/gtk/src/ygtkratiobox.c trunk/gtk/src/ygtkratiobox.h Modified: trunk/gtk/ChangeLog URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/ChangeLog?rev=47992&r1=47991…
============================================================================== --- trunk/gtk/ChangeLog (original) +++ trunk/gtk/ChangeLog Mon Jun 2 16:25:02 2008 @@ -1,3 +1,14 @@ +2008-06-02 Ricardo Cruz <rpmcruz(a)alunos.dcc.fc.up.pt> + + * src/YGWidget.h/cc & src/YGLayout.h/cc: now using libyui for + the layout to avoid bugs and stuff. It's inter-laced with GTK, + so we can keep our simplified containers like the dumbtab. + + * src/ygtkfixed.h/.c: added this container that makes life easier + for YGLayoutBox and others. + + * src/ygtkratiobox.h/.c: simplified it. + 2008-05-28 Ricardo Cruz <rpmcruz(a)alunos.dcc.fc.up.pt> * src/YGDialog.cc: bug fix: seems like we shouldn't unref the Modified: trunk/gtk/src/Makefile.am URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/Makefile.am?rev=47992&r1…
============================================================================== --- trunk/gtk/src/Makefile.am (original) +++ trunk/gtk/src/Makefile.am Mon Jun 2 16:25:02 2008 @@ -40,6 +40,7 @@ YGWizard.cc \ YGPackageSelector.cc \ ygtkratiobox.c \ + ygtkfixed.c \ ygtkbargraph.c \ ygtksteps.c \ ygtkfieldentry.c \ Modified: trunk/gtk/src/YGBarGraph.cc URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGBarGraph.cc?rev=47992&…
============================================================================== --- trunk/gtk/src/YGBarGraph.cc (original) +++ trunk/gtk/src/YGBarGraph.cc Mon Jun 2 16:25:02 2008 @@ -15,7 +15,9 @@ YGBarGraph (YWidget *parent) : YBarGraph (NULL) , YGWidget (this, parent, true, YGTK_TYPE_BAR_GRAPH, NULL) - {} + { + setMinSize (500, 0); + } // YBarGraph virtual void doUpdate() Modified: trunk/gtk/src/YGDialog.cc URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGDialog.cc?rev=47992&r1…
============================================================================== --- trunk/gtk/src/YGDialog.cc (original) +++ trunk/gtk/src/YGDialog.cc Mon Jun 2 16:25:02 2008 @@ -7,90 +7,6 @@ #include <gdk/gdkkeysyms.h> #include <math.h> // easter -/* - * GtkWindow sub-class to ensure we can't get a size-allocation - * that is larger than the screen. - */ -typedef struct { - GtkWindow parent; - gboolean fullscreen; -} YGtkWindow; - -typedef struct { - GtkWindowClass parent_class; -} YGtkWindowClass; - -G_DEFINE_TYPE (YGtkWindow, ygtk_window, GTK_TYPE_WINDOW) - -static void ygtk_window_set_fullscreen (YGtkWindow *window, - gboolean fullscreen) -{ - window->fullscreen = fullscreen; -} - -static void ygtk_window_size_request (GtkWidget *widget, - GtkRequisition *requisition) -{ - YGtkWindow *ywindow = (YGtkWindow *) widget; - - GTK_WIDGET_CLASS (ygtk_window_parent_class)->size_request (widget, requisition); - -// fprintf (stderr, "ygtk_window_size_request: %d %d\n", -// requisition->width, requisition->height); - - GdkScreen *screen = gtk_widget_get_screen (widget); - int max_screen_width = gdk_screen_get_width (screen); - int max_screen_height = gdk_screen_get_height (screen); - - /* - * FIXME: do we want to call gdk_window_get_frame_extents - * on the root window ? - will that tell us about panels etc. ? - * - * FIXME: do we want to defer 'map' until we can get our - * frame size from the realized window to do better here ? - */ - - // in the meantime shrink ourselves a little, to account for - // window decoration / panels etc. - if (!ywindow->fullscreen) - { - max_screen_height = 0.90 * max_screen_height; - max_screen_width = 0.90 * max_screen_width; - } - - if (requisition->width > max_screen_width) - { -// fprintf (stderr, "cropping width from %d to %d\n", -// requisition->width, max_screen_width); - requisition->width = max_screen_width; - } - if (requisition->height > max_screen_height) - { -// fprintf (stderr, "cropping height from %d to %d\n", -// requisition->height, max_screen_height); - requisition->height = max_screen_height; - } -} - -static void ygtk_window_size_allocate (GtkWidget *widget, - GtkAllocation *allocation) -{ -/* fprintf (stderr, "YGDialog size alloc %d %d\n", - allocation->width, allocation->height); */ - GTK_WIDGET_CLASS (ygtk_window_parent_class)->size_allocate (widget, allocation); -} - -static void ygtk_window_init (YGtkWindow *) {} -static void ygtk_window_class_init (YGtkWindowClass *klass) -{ - GtkWidgetClass *wklass = (GtkWidgetClass *) klass; - - ygtk_window_parent_class = g_type_class_peek_parent (klass); - - wklass->size_request = ygtk_window_size_request; - wklass->size_allocate = ygtk_window_size_allocate; -} - /* In the main dialog case, it doesn't necessarly have a window of its own. If there is already a main window, it should replace its content -- and when closed, the previous dialog restored. @@ -100,6 +16,8 @@ be a YGDialog and is swap-able. */ +#define DEFAULT_WIDTH 650 +#define DEFAULT_HEIGHT 550 class YGWindow; static YGWindow *main_window = 0; @@ -118,9 +36,9 @@ YGWindow (bool _main_window, YGDialog *ydialog) { - m_widget = GTK_WIDGET (g_object_new (ygtk_window_get_type(), NULL)); - g_object_ref (G_OBJECT (m_widget)); - gtk_object_sink (GTK_OBJECT (m_widget)); + m_widget = gtk_window_new (GTK_WINDOW_TOPLEVEL); + g_object_ref_sink (G_OBJECT (m_widget)); + g_object_set (G_OBJECT (m_widget), "allow-shrink", TRUE, NULL); m_refcount = 0; m_child = NULL; @@ -161,14 +79,9 @@ } if (_main_window) { - int w = YGUI::ui()->_getDefaultWidth(), - h = YGUI::ui()->_getDefaultHeight(); - gtk_window_set_default_size (window, w, h); - - if (YGUI::ui()->setFullscreen()) { - gtk_window_fullscreen (window); - ygtk_window_set_fullscreen ((YGtkWindow *)window, TRUE); - } + gtk_window_set_default_size (window, DEFAULT_WIDTH, DEFAULT_HEIGHT); + if (YGUI::ui()->setFullscreen()) + gtk_window_fullscreen (window); } gtk_window_set_role (window, "yast2-gtk"); @@ -202,8 +115,9 @@ void normalCursor() { - if (GTK_WIDGET_REALIZED (m_widget)) + if (GTK_WIDGET_REALIZED (m_widget)) { gdk_window_set_cursor (m_widget->window, NULL); + } } void busyCursor() @@ -270,8 +184,7 @@ IMPL // if not main dialog, close it on escape if (event->keyval == GDK_Escape && - /* not main window */ main_window != pThis) - { + /* not main window */ main_window != pThis) { pThis->close(); return TRUE; @@ -403,9 +316,6 @@ gtk_box_pack_start (GTK_BOX (getWidget()), icon, FALSE, FALSE, 12); gtk_box_pack_start (GTK_BOX (getWidget()), m_containee, TRUE, TRUE, 0); - - GtkRequisition req; - gtk_widget_size_request (icon, &req); } else gtk_box_pack_start (GTK_BOX (getWidget()), m_containee, TRUE, TRUE, 0); @@ -482,21 +392,12 @@ { // libyui calls YDialog::setSize() to force a geometry recalculation as a // result of changed layout properties - struct inner { - static void syncStretchable (YWidget *ywidget, YGWidget *widget) - { - for (YWidgetListConstIterator it = ywidget->childrenBegin(); - it != ywidget->childrenEnd(); it++) { - YWidget *ychild = const_cast <YWidget *> (*it); - YGWidget *child = YGWidget::get (ychild); - if (child) { - widget->syncStretchable (ychild, child); - syncStretchable (ychild, child); - } - } - } - }; - inner::syncStretchable (this, this); + GtkWidget *window = m_window->getWidget(); + if (GTK_WIDGET_REALIZED (window)) { + gtk_widget_queue_resize (window); + if (!isMainDialog()) + gtk_window_resize (GTK_WINDOW (window), width, height); + } } YDialog *YGWidgetFactory::createDialog (YDialogType dialogType, YDialogColorMode colorMode) Modified: trunk/gtk/src/YGDialog.h URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGDialog.h?rev=47992&r1=…
============================================================================== --- trunk/gtk/src/YGDialog.h (original) +++ trunk/gtk/src/YGDialog.h Mon Jun 2 16:25:02 2008 @@ -29,8 +29,8 @@ virtual void setSize (int width, int height); virtual void setEnabled (bool enabled); - virtual int preferredWidth() { return 0; } - virtual int preferredHeight() { return 0; } +// virtual int preferredWidth() { return 0; } +// virtual int preferredHeight() { return 0; } virtual void openInternal(); virtual void activate(); Modified: trunk/gtk/src/YGLabel.cc URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGLabel.cc?rev=47992&r1=…
============================================================================== --- trunk/gtk/src/YGLabel.cc (original) +++ trunk/gtk/src/YGLabel.cc Mon Jun 2 16:25:02 2008 @@ -27,11 +27,16 @@ virtual void setText (const string &label) { - gtk_label_set_label (GTK_LABEL (getWidget()), label.c_str()); + if (isOutputField()) { + std::string l (label); + std::string::size_type i = l.find ('\n', 0); + if (i != std::string::npos) + l.erase (i); + gtk_label_set_label (GTK_LABEL (getWidget()), l.c_str()); + } + else + gtk_label_set_label (GTK_LABEL (getWidget()), label.c_str()); YLabel::setText (label); - - // Some YCP progs have no labeled labels cluttering the layout - label.empty() ? gtk_widget_hide (getWidget()) : gtk_widget_show (getWidget()); } YGWIDGET_IMPL_COMMON Modified: trunk/gtk/src/YGLayout.cc URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGLayout.cc?rev=47992&r1…
============================================================================== --- trunk/gtk/src/YGLayout.cc (original) +++ trunk/gtk/src/YGLayout.cc Mon Jun 2 16:25:02 2008 @@ -7,104 +7,53 @@ #include "YGWidget.h" #include "YGUtils.h" +/* Our layout stuff is a hybrid between GTK and libyui. We use libyui + for YLayoutBox and a couple of other widgets, but we do things GTK + friendly, so for single-child containers like GtkNotebook we don't + have to do any work. */ + +#include "ygtkfixed.h" + +static void doMoveChild (GtkWidget *fixed, YWidget *ychild, int x, int y) +{ + GtkWidget *child = YGWidget::get (ychild)->getLayout(); + ygtk_fixed_set_child_pos (YGTK_FIXED (fixed), child, x, y); +} + +#define YGLAYOUT_INIT \ + ygtk_fixed_setup (YGTK_FIXED (getWidget()), preferred_size_cb, set_size_cb, this); +#define YGLAYOUT_PREFERRED_SIZE_IMPL(ParentClass) \ + static void preferred_size_cb (YGtkFixed *fixed, gint *width, gint *height, \ + gpointer pThis) { \ + *width = ((ParentClass *) pThis)->ParentClass::preferredWidth(); \ + *height = ((ParentClass *) pThis)->ParentClass::preferredHeight(); \ + } +#define YGLAYOUT_SET_SIZE_IMPL(ParentClass) \ + static void set_size_cb (YGtkFixed *fixed, gint width, gint height, \ + gpointer pThis) { \ + ((ParentClass *) pThis)->ParentClass::setSize (width, height); \ + } \ + virtual void setSize (int width, int height) { doSetSize (width, height); } \ + virtual void moveChild (YWidget *ychild, int x, int y) \ + { doMoveChild (getWidget(), ychild, x, y); } + #include "YLayoutBox.h" -#include "ygtkratiobox.h" -#include "YSpacing.h" -#include "YPushButton.h" -#include "YMenuButton.h" -// GtkBox-like container (actually, more like our YGtkRatioBox) class YGLayoutBox : public YLayoutBox, public YGWidget { - // This group is meant to set all YGLabeledWidget with horizontal label - // to share the same width (if they belong to the same YSplit), so they - // look right - GtkSizeGroup *m_labels_group, *m_buttons_group; - public: YGLayoutBox (YWidget *parent, YUIDimension dim) : YLayoutBox (NULL, dim), - YGWidget (this, parent, true, - dim == YD_HORIZ ? YGTK_TYPE_RATIO_HBOX : YGTK_TYPE_RATIO_VBOX, NULL) + YGWidget (this, parent, true, YGTK_TYPE_FIXED, NULL) { setBorder (0); - m_labels_group = m_buttons_group = NULL; - } - - ~YGLayoutBox() - { - if (m_labels_group) - g_object_unref (G_OBJECT (m_labels_group)); - if (m_buttons_group) - g_object_unref (G_OBJECT (m_buttons_group)); + YGLAYOUT_INIT } YGWIDGET_IMPL_CHILD_ADDED (getWidget()) YGWIDGET_IMPL_CHILD_REMOVED (getWidget()) - virtual void moveChild (YWidget *child, int x, int y) {} - - void addSizeGroup (YGLabeledWidget *labeledWidget) - { - GtkWidget *label = labeledWidget->getLabelWidget(); - if (m_labels_group) { - GSList *labels = gtk_size_group_get_widgets (m_labels_group); - if (g_slist_find (labels, label)) // contains label already? - return; - // labels is not to be freed! - } - else - m_labels_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); - gtk_size_group_add_widget (m_labels_group, label); - } - - virtual void syncStretchable (YWidget *ychild, YGWidget *child) - { - IMPL - YGtkRatioBox *box = YGTK_RATIO_BOX (getWidget()); - - YUIDimension dim = primary(); - bool horiz_fill = ychild->stretchable (YD_HORIZ) || ychild->hasWeight (YD_HORIZ); - bool vert_fill = ychild->stretchable (YD_VERT) || ychild->hasWeight (YD_VERT); - - ygtk_ratio_box_set_child_packing (box, child->getLayout(), ychild->stretchable (dim), - isLayoutStretch (ychild, dim), ychild->weight (dim), horiz_fill, vert_fill, 0); - - // set all buttons to same height -- cause of stock icons... - if (dim == YD_HORIZ) { - bool isButton = false; - if (dynamic_cast <YPushButton *> (ychild)) - isButton = true; - else if (dynamic_cast <YMenuButton *> (ychild)) - isButton = true; - if (isButton) { - if (!m_buttons_group) - m_buttons_group = gtk_size_group_new (GTK_SIZE_GROUP_VERTICAL); - gtk_size_group_add_widget (m_buttons_group, child->getWidget()); - } - } - - // align horizontal widget labels to the same width - // we do some work here, since they may be placed inside a HBox or something... - if (dim == YD_HORIZ && !horiz_fill) - return; - YWidget *yLabeledWidget = ychild; - while (yLabeledWidget->hasChildren()) { // container - YWidget *container = yLabeledWidget; - for (YWidgetListConstIterator it = container->childrenBegin(); - it != container->childrenEnd(); it++) { - yLabeledWidget = *it; - if (!dynamic_cast <YSpacing *> (yLabeledWidget) /*ignore spacings*/) - break; - } - } - YGLabeledWidget *labeledWidget = - dynamic_cast <YGLabeledWidget *> (YGWidget::get (yLabeledWidget)); - if (labeledWidget && labeledWidget->orientation() == YD_HORIZ) { -/* horiz_fill = yLabeledWidget->stretchable (YD_HORIZ) || yLabeledWidget->hasWeight (YD_HORIZ); - if (horiz_fill)*/ - addSizeGroup (labeledWidget); - } - } + YGLAYOUT_PREFERRED_SIZE_IMPL (YLayoutBox) + YGLAYOUT_SET_SIZE_IMPL (YLayoutBox) }; YLayoutBox *YGWidgetFactory::createLayoutBox (YWidget *parent, YUIDimension dimension) @@ -122,10 +71,11 @@ public: YGAlignment (YWidget *parent, YAlignmentType halign, YAlignmentType valign) : YAlignment (NULL, halign, valign), - YGWidget (this, parent, true, GTK_TYPE_ALIGNMENT, NULL) + YGWidget (this, parent, true, YGTK_TYPE_FIXED, NULL) { setBorder (0); m_background_pixbuf = 0; + YGLAYOUT_INIT } virtual ~YGAlignment() @@ -134,61 +84,10 @@ g_object_unref (G_OBJECT (m_background_pixbuf)); } - virtual void doAddChild (YWidget *ychild, GtkWidget *container) - { - YGWidget::doAddChild (ychild, container); - - /* 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()); - } YGWIDGET_IMPL_CHILD_ADDED (m_widget) YGWIDGET_IMPL_CHILD_REMOVED (m_widget) - virtual void moveChild (YWidget *child, int x, int y) {} - - virtual void syncStretchable (YWidget *ychild, YGWidget *child) - { - IMPL - setAlignment (alignment (YD_HORIZ), alignment (YD_VERT)); - } - - void setAlignment (YAlignmentType halign, YAlignmentType valign) - { - struct inner { - // helper -- converts YWidget YAlignmentType to Gtk's align float - static float yToGtkAlign (YAlignmentType align) - { - switch (align) { - case YAlignBegin: return 0.0; - default: - case YAlignCenter: return 0.5; - case YAlignEnd: return 1.0; - } - } - }; - - float xalign, yalign, xscale, yscale; - xalign = inner::yToGtkAlign (halign); - yalign = inner::yToGtkAlign (valign); - xscale = (halign == YAlignUnchanged) ? 1 : 0; - yscale = (valign == YAlignUnchanged) ? 1 : 0; - if (hasChildren()) { - // special case: child has stretch opt - if (!xscale && firstChild()->stretchable (YD_HORIZ)) - xscale = 1; - if (!yscale && firstChild()->stretchable (YD_VERT)) - yscale = 1; - } - gtk_alignment_set (GTK_ALIGNMENT (getWidget()), xalign, yalign, xscale, yscale); - } - - void setPadding (int top, int bottom, int left, int right) - { - gtk_alignment_set_padding (GTK_ALIGNMENT (getWidget()), - top, bottom, left, right); - } + YGLAYOUT_PREFERRED_SIZE_IMPL (YAlignment) + YGLAYOUT_SET_SIZE_IMPL (YAlignment) virtual void setBackgroundPixmap (string filename) { @@ -234,32 +133,6 @@ GTK_BIN (widget)->child, event); return TRUE; } - - virtual string getDebugLabel() const - { - struct inner { - static const char *alignLabel (YAlignmentType align) - { - switch (align) { - case YAlignUnchanged: - return "unchanged"; - case YAlignBegin: - return "begin"; - case YAlignEnd: - return "end"; - case YAlignCenter: - return "center"; - } - return ""; /*not run*/ - } - }; - - string str; - str += inner::alignLabel (alignment (YD_HORIZ)); - str += " x "; - str += inner::alignLabel (alignment (YD_VERT)); - return str; - } }; YAlignment *YGWidgetFactory::createAlignment (YWidget *parent, YAlignmentType halign, @@ -299,14 +172,16 @@ public: YGSpacing (YWidget *parent, YUIDimension dim, bool stretchable, YLayoutSize_t size) : YSpacing (NULL, dim, stretchable, size), - YGWidget (this, parent, true, GTK_TYPE_EVENT_BOX, NULL) + YGWidget (this, parent, true, YGTK_TYPE_FIXED, NULL) { setBorder (0); - int width = YSpacing::size (YD_HORIZ), height = YSpacing::size (YD_VERT); - gtk_widget_set_size_request (getWidget(), width, height); + YGLAYOUT_INIT } YGWIDGET_IMPL_COMMON + YGLAYOUT_PREFERRED_SIZE_IMPL (YLayoutBox) + static void set_size_cb (YGtkFixed *fixed, gint width, gint height, + gpointer pThis) {} }; YSpacing *YGWidgetFactory::createSpacing (YWidget *parent, YUIDimension dim, @@ -317,9 +192,6 @@ #include "YReplacePoint.h" -//TEMP: -#include "YPushButton.h" - // an empty space that will get replaced class YGReplacePoint : public YReplacePoint, public YGWidget { @@ -331,6 +203,7 @@ setBorder (0); } + YGWIDGET_IMPL_COMMON YGWIDGET_IMPL_CHILD_ADDED (getWidget()) YGWIDGET_IMPL_CHILD_REMOVED (getWidget()) }; @@ -355,6 +228,7 @@ setBorder (0); } + YGWIDGET_IMPL_COMMON YGWIDGET_IMPL_CHILD_ADDED (getWidget()) YGWIDGET_IMPL_CHILD_REMOVED (getWidget()) }; Modified: trunk/gtk/src/YGProgressBar.cc URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGProgressBar.cc?rev=479…
============================================================================== --- trunk/gtk/src/YGProgressBar.cc (original) +++ trunk/gtk/src/YGProgressBar.cc Mon Jun 2 16:25:02 2008 @@ -99,7 +99,6 @@ , YGWidget (this, parent, true, horizontal() ? YGTK_TYPE_RATIO_HBOX : YGTK_TYPE_RATIO_VBOX, NULL) { -// ygtk_ratio_box_set_homogeneous (YGTK_RATIO_BOX (getWidget()), TRUE); ygtk_ratio_box_set_spacing (YGTK_RATIO_BOX (getWidget()), 2); for (int s = 0; s < segments(); s++) { GtkWidget* bar = gtk_progress_bar_new(); @@ -111,8 +110,7 @@ gtk_widget_set_size_request (bar, min_size, -1); else gtk_widget_set_size_request (bar, -1, min_size); - ygtk_ratio_box_pack (YGTK_RATIO_BOX (getWidget()), bar, - getSegmentWeight (s), TRUE, TRUE, 0); + ygtk_ratio_box_pack (YGTK_RATIO_BOX (getWidget()), bar, getSegmentWeight (s)); } ygtk_adj_size_set_max (YGTK_ADJ_SIZE (m_adj_size), horizontal() ? 200 : 0, Modified: trunk/gtk/src/YGUI.cc URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGUI.cc?rev=47992&r1=479…
============================================================================== --- trunk/gtk/src/YGUI.cc (original) +++ trunk/gtk/src/YGUI.cc Mon Jun 2 16:25:02 2008 @@ -37,7 +37,6 @@ IMPL m_have_wm = true; m_no_border = m_fullscreen = false; - m_default_size.width = m_default_size.height = 0; YGUI::setTextdomain( TEXTDOMAIN ); @@ -88,15 +87,6 @@ m_fullscreen = true; else if (!strcmp (argp, "noborder")) m_no_border = true; - else if (!strcmp (argp, "geometry")) { - argp = argv [++i]; - if (i == argc) - printf ("Warning: no value passed to --geometry\n"); - else if (sscanf (argp, "%dx%d", &m_default_size.width, - &m_default_size.height) == EOF) { - printf ("Warning: invalid --geometry value: %s\n", argp); - } - } else if (!strcmp (argp, "help")) { printf ( "Command line options for the YaST2 Gtk UI:\n" @@ -127,20 +117,6 @@ static int getDisplayHeight() { return gdk_screen_get_height (getScreen()); } -int YGUI::_getDefaultWidth() -{ - if (!m_default_size.width) - m_default_size.width = MIN (600, getDisplayWidth()); - return m_default_size.width; -} - -int YGUI::_getDefaultHeight() -{ - if (!m_default_size.height) - m_default_size.height = MIN (450, getDisplayHeight()); - return m_default_size.height; -} - static gboolean ycp_wakeup_fn (GIOChannel *source, GIOCondition condition, gpointer data) { Modified: trunk/gtk/src/YGUI.h URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGUI.h?rev=47992&r1=4799…
============================================================================== --- trunk/gtk/src/YGUI.h (original) +++ trunk/gtk/src/YGUI.h Mon Jun 2 16:25:02 2008 @@ -89,11 +89,9 @@ // window-related arguments bool m_have_wm, m_no_border, m_fullscreen; - GtkRequisition m_default_size; public: // Helpers for internal use [ visibility hidden ] - int _getDefaultWidth(); int _getDefaultHeight(); bool setFullscreen() const { return m_fullscreen; } bool hasWM() const { return m_have_wm; } bool unsetBorder() const { return m_no_border; } Modified: trunk/gtk/src/YGWidget.cc URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGWidget.cc?rev=47992&r1…
============================================================================== --- trunk/gtk/src/YGWidget.cc (original) +++ trunk/gtk/src/YGWidget.cc Mon Jun 2 16:25:02 2008 @@ -48,14 +48,20 @@ ywidget->setParent (yparent); yparent->addChild (ywidget); } + m_sizeReq.width = 0; } YGWidget::~YGWidget() { IMPL + // remove children if container? +#if 0 + if (GTK_IS_CONTAINER (m_widget)) + gtk_container_foreach (GTK_CONTAINER (m_widget), + (GtkCallback) gtk_container_remove, NULL); +#endif gtk_widget_destroy (m_adj_size); g_object_unref (G_OBJECT (m_adj_size)); - // remove all children if container? } void YGWidget::show() @@ -106,6 +112,26 @@ } } +int YGWidget::getPreferredSize (YUIDimension dimension) +{ + if (!m_sizeReq.width) + gtk_widget_size_request (m_adj_size, &m_sizeReq); + return dimension == YD_HORIZ ? m_sizeReq.width : m_sizeReq.height; +} + +#include "ygtkfixed.h" + +void YGWidget::doSetSize (int width, int height) +{ + GtkWidget *parent = 0; + if (m_ywidget->parent()) + parent = YGWidget::get (m_ywidget->parent())->getWidget(); + + if (parent && YGTK_IS_FIXED (parent)) + ygtk_fixed_set_child_size (YGTK_FIXED (parent), m_adj_size, width, height); + m_sizeReq.width = 0; +} + void YGWidget::emitEvent(YEvent::EventReason reason, bool if_notify, bool if_not_pending, bool immediate) { @@ -161,7 +187,8 @@ bool show, GType type, const char *property_name, ...) : YGWidget (ywidget, parent, show, - label_ori == YD_VERT ? GTK_TYPE_VBOX : GTK_TYPE_HBOX, +// label_ori == YD_VERT ? GTK_TYPE_VBOX : GTK_TYPE_HBOX, + GTK_TYPE_VBOX, "spacing", LABEL_WIDGET_SPACING, NULL) { // Create the field widget Modified: trunk/gtk/src/YGWidget.h URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGWidget.h?rev=47992&r1=…
============================================================================== --- trunk/gtk/src/YGWidget.h (original) +++ trunk/gtk/src/YGWidget.h Mon Jun 2 16:25:02 2008 @@ -47,11 +47,12 @@ void setMinSize (unsigned int min_width, unsigned int min_height); void setMinSizeInChars (unsigned int min_width, unsigned int min_height); - // whenever the stretchable property may change (eg. when adding a child - // for a container), call this function to make sure it is honored. - virtual void syncStretchable (YWidget *ychild, YGWidget *child) {} - protected: + // layout + virtual int getPreferredSize (YUIDimension dimension); + void doSetSize (int width, int height); + GtkRequisition m_sizeReq; // cache + void show(); GtkWidget *m_widget; // associated GtkWidget -- use getWidget() @@ -75,9 +76,9 @@ doSetEnabled (enabled); \ YWidget::setEnabled (enabled); \ } \ - virtual int preferredWidth() { return 0; } \ - virtual int preferredHeight() { return 0; } \ - virtual void setSize (int width, int height) {} + virtual int preferredWidth() { return getPreferredSize (YD_HORIZ); } \ + virtual int preferredHeight() { return getPreferredSize (YD_VERT); } \ + virtual void setSize (int width, int height) { doSetSize (width, height); } #define YGWIDGET_IMPL_USE_BOLD(ParentClass) \ virtual void setUseBoldFont (bool useBold) { \ Modified: trunk/gtk/src/ygtkbargraph.c URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkbargraph.c?rev=47992…
============================================================================== --- trunk/gtk/src/ygtkbargraph.c (original) +++ trunk/gtk/src/ygtkbargraph.c Mon Jun 2 16:25:02 2008 @@ -25,9 +25,6 @@ static void ygtk_bar_graph_size_request (GtkWidget *widget, GtkRequisition *requisition) { GTK_WIDGET_CLASS (ygtk_bar_graph_parent_class)->size_request (widget, requisition); - const int max_width = 250; - if (requisition->width > max_width) - requisition->width = max_width; requisition->height += 6; } @@ -95,8 +92,7 @@ // Set proportion gtk_widget_set_size_request (box, 10, -1); // for homogeneous... - ygtk_ratio_box_set_child_packing (YGTK_RATIO_BOX (bar), box, TRUE, FALSE, - MAX (value, 1), TRUE, TRUE, 0); + ygtk_ratio_box_set_child_packing (YGTK_RATIO_BOX (bar), box, MAX (value, 1)); // Set background color // The Tango palette Added: trunk/gtk/src/ygtkfixed.c URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkfixed.c?rev=47992&vi…
============================================================================== --- trunk/gtk/src/ygtkfixed.c (added) +++ trunk/gtk/src/ygtkfixed.c Mon Jun 2 16:25:02 2008 @@ -0,0 +1,139 @@ +/******************************************************************** + * YaST2-GTK -
http://en.opensuse.org/YaST2-GTK
* + ********************************************************************/ + +/* YGtkFixed container */ +// check the header file for information about this container + +#include <config.h> +#include <math.h> +#include <gtk/gtk.h> +#include "ygtkfixed.h" + +G_DEFINE_TYPE (YGtkFixed, ygtk_fixed, GTK_TYPE_CONTAINER) + +static void ygtk_fixed_init (YGtkFixed *fixed) +{ + GTK_WIDGET_SET_FLAGS (fixed, GTK_NO_WINDOW); + gtk_widget_set_redraw_on_allocate (GTK_WIDGET (fixed), FALSE); +} + +void ygtk_fixed_setup (YGtkFixed *fixed, YGtkPreferredSize cb1, YGtkSetSize cb2, gpointer data) +{ + fixed->preferred_size_cb = cb1; + fixed->set_size_cb = cb2; + fixed->data = data; +} + +static YGtkFixedChild *ygtk_fixed_get_child (YGtkFixed *fixed, GtkWidget *widget) +{ + GSList *i; + for (i = fixed->children; i; i = i->next) { + YGtkFixedChild *child = i->data; + if (child->widget == widget) + return child; + } + return NULL; +} + +void ygtk_fixed_set_child_pos (YGtkFixed *fixed, GtkWidget *widget, gint x, gint y) +{ + YGtkFixedChild *child = ygtk_fixed_get_child (fixed, widget); + child->x = x; + child->y = y; +} + +void ygtk_fixed_set_child_size (YGtkFixed *fixed, GtkWidget *widget, gint width, gint height) +{ + YGtkFixedChild *child = ygtk_fixed_get_child (fixed, widget); + child->width = width; + child->height = height; +} + +static void ygtk_fixed_add (GtkContainer *container, GtkWidget *widget) +{ + YGtkFixed *fixed = YGTK_FIXED (container); + YGtkFixedChild *child = g_new0 (YGtkFixedChild, 1); + child->widget = widget; + child->width = child->height = 50; + fixed->children = g_slist_append (fixed->children, child); + gtk_widget_set_parent (widget, GTK_WIDGET (fixed)); +} + +static void ygtk_fixed_remove (GtkContainer *container, GtkWidget *widget) +{ + YGtkFixed *fixed = YGTK_FIXED (container); + GSList *i; + for (i = fixed->children; i; i = i->next) { + YGtkFixedChild *child = i->data; + if (child->widget == widget) { + gboolean was_visible = GTK_WIDGET_VISIBLE (widget); + gtk_widget_unparent (widget); + fixed->children = g_slist_delete_link (fixed->children, i); + g_free (child); + if (was_visible) + gtk_widget_queue_resize (GTK_WIDGET (container)); + break; + } + } +} + +static void ygtk_fixed_forall (GtkContainer *container, gboolean include_internals, + GtkCallback callback, gpointer callback_data) +{ + g_return_if_fail (callback != NULL); + YGtkFixed *fixed = YGTK_FIXED (container); + GSList *i = fixed->children; + while (i) { + YGtkFixedChild *child = i->data; + i = i->next; // current node might get removed... + (* callback) (child->widget, callback_data); + } +} + +static void ygtk_fixed_size_request (GtkWidget *widget, + GtkRequisition *requisition) +{ + YGtkFixed *fixed = YGTK_FIXED (widget); + fixed->preferred_size_cb (fixed, &requisition->width, &requisition->height, + fixed->data); + + GTK_WIDGET_CLASS (ygtk_fixed_parent_class)->size_request (widget, requisition); +} + +static void ygtk_fixed_size_allocate (GtkWidget *widget, + GtkAllocation *allocation) +{ + YGtkFixed *fixed = YGTK_FIXED (widget); + fixed->set_size_cb (fixed, allocation->width, allocation->height, fixed->data); + + GSList *i; + for (i = fixed->children; i; i = i->next) { + YGtkFixedChild *child = i->data; + int x = child->x + allocation->x; + int y = child->y + allocation->y; + GtkAllocation child_alloc = + { x, y, child->width, child->height }; + gtk_widget_size_allocate (child->widget, &child_alloc); + } + GTK_WIDGET_CLASS (ygtk_fixed_parent_class)->size_allocate (widget, allocation); +} + +static GType ygtk_fixed_child_type (GtkContainer *container) +{ return GTK_TYPE_WIDGET; } + +static void ygtk_fixed_class_init (YGtkFixedClass *klass) +{ + ygtk_fixed_parent_class = g_type_class_peek_parent (klass); + + GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass); + container_class->add = ygtk_fixed_add; + container_class->remove = ygtk_fixed_remove; + container_class->forall = ygtk_fixed_forall; + container_class->child_type = ygtk_fixed_child_type; + + GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); + widget_class->size_request = ygtk_fixed_size_request; + widget_class->size_allocate = ygtk_fixed_size_allocate; +} + Added: trunk/gtk/src/ygtkfixed.h URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkfixed.h?rev=47992&vi…
============================================================================== --- trunk/gtk/src/ygtkfixed.h (added) +++ trunk/gtk/src/ygtkfixed.h Mon Jun 2 16:25:02 2008 @@ -0,0 +1,64 @@ +/******************************************************************** + * YaST2-GTK -
http://en.opensuse.org/YaST2-GTK
* + ********************************************************************/ + +/* GtkFixed just doesn't cut it... gtk_fixed_move_child() does a queue_resize + and the all thing is just not quite appropriate... */ + +#ifndef YGTK_FIXED_H +#define YGTK_FIXED_H + +#include <gtk/gtkcontainer.h> +G_BEGIN_DECLS + +#define YGTK_TYPE_FIXED (ygtk_fixed_get_type ()) +#define YGTK_FIXED(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ + YGTK_TYPE_FIXED, YGtkFixed)) +#define YGTK_FIXED_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \ + YGTK_TYPE_FIXED, YGtkFixedClass)) +#define YGTK_IS_FIXED(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ + YGTK_TYPE_FIXED)) +#define YGTK_IS_FIXED_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \ + YGTK_TYPE_FIXED)) +#define YGTK_FIXED_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \ + YGTK_TYPE_FIXED, YGtkFixedClass)) + +typedef struct _YGtkFixed YGtkFixed; +typedef struct _YGtkFixedClass YGtkFixedClass; + +typedef void (*YGtkPreferredSize) (YGtkFixed *, gint *, gint *, gpointer); +typedef void (*YGtkSetSize) (YGtkFixed *, gint, gint, gpointer); + +struct _YGtkFixed +{ + GtkContainer parent; + // private (read-only): + GSList *children; + YGtkPreferredSize preferred_size_cb; + YGtkSetSize set_size_cb; + gpointer data; +}; + +struct _YGtkFixedClass +{ + GtkContainerClass parent_class; +}; + +typedef struct _YGtkFixedChild +{ + GtkWidget *widget; + // members + // post-pone all position and size setting, to avoid unnecessary work + gint x, y, width, height; +} YGtkFixedChild; + +GType ygtk_fixed_get_type (void) G_GNUC_CONST; + +void ygtk_fixed_setup (YGtkFixed *fixed, YGtkPreferredSize cb1, YGtkSetSize cb2, gpointer data); + +void ygtk_fixed_set_child_pos (YGtkFixed *fixed, GtkWidget *widget, gint x, gint y); +void ygtk_fixed_set_child_size (YGtkFixed *fixed, GtkWidget *widget, gint width, gint height); + +G_END_DECLS +#endif /*YGTK_FIXED_H*/ + Modified: trunk/gtk/src/ygtkratiobox.c URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkratiobox.c?rev=47992…
============================================================================== --- trunk/gtk/src/ygtkratiobox.c (original) +++ trunk/gtk/src/ygtkratiobox.c Mon Jun 2 16:25:02 2008 @@ -2,8 +2,8 @@ * YaST2-GTK -
http://en.opensuse.org/YaST2-GTK
* ********************************************************************/ -/* YGtkRatioBox widget */ -// check the header file for information about this widget +/* YGtkRatioBox container */ +// check the header file for information about this container #include <config.h> #include <math.h> @@ -20,18 +20,12 @@ static GType ygtk_ratio_box_child_type (GtkContainer* container) { return GTK_TYPE_WIDGET; } -void ygtk_ratio_box_pack (YGtkRatioBox *box, GtkWidget *child, - gfloat ratio, gboolean xfill, gboolean yfill, - guint padding) +void ygtk_ratio_box_pack (YGtkRatioBox *box, GtkWidget *child, gfloat ratio) { YGtkRatioBoxChild* child_info; child_info = g_new (YGtkRatioBoxChild, 1); child_info->widget = child; child_info->ratio = ratio; - child_info->padding = padding; - child_info->xfill = xfill; - child_info->yfill = yfill; - child_info->expand = 0; box->children = g_list_append (box->children, child_info); @@ -56,7 +50,7 @@ static void ygtk_ratio_box_add (GtkContainer *container, GtkWidget *child) { - ygtk_ratio_box_pack (YGTK_RATIO_BOX (container), child, 1.0, TRUE, TRUE, 0); + ygtk_ratio_box_pack (YGTK_RATIO_BOX (container), child, 1.0); } static void ygtk_ratio_box_remove (GtkContainer *container, GtkWidget *widget) @@ -104,67 +98,29 @@ GtkRequisition *requisition, GtkOrientation orientation) { - YGtkRatioBox* box = YGTK_RATIO_BOX (widget); - gfloat ratios_sum = 0; - box->has_must_expand = FALSE; - GList* child; - for (child = box->children; child; child = child->next) { - YGtkRatioBoxChild* box_child = (YGtkRatioBoxChild*) child->data; - if (!GTK_WIDGET_VISIBLE (box_child->widget)) - continue; - if (box_child->ratio) - ratios_sum += box_child->ratio; - if (box_child->must_expand) - box->has_must_expand = TRUE; - } - - // If we want to calculate horizontal size, primary_req would be horizontal - // length, while secondary the height. Idem for the inverse. - guint primary_req = 0, secondary_req = 0; - box->weight_length = 0; // biggest ratio of widget-size / widget-ratio + requisition->width = requisition->height = 0; - for (child = box->children; child; child = child->next) { - YGtkRatioBoxChild* box_child = (YGtkRatioBoxChild*) child->data; - if (!GTK_WIDGET_VISIBLE (box_child->widget)) + YGtkRatioBox* box = YGTK_RATIO_BOX (widget); + gint children_nb = 0; + GList *i; + for (i = box->children; i; i = i->next) { + YGtkRatioBoxChild* child = i->data; + if (!GTK_WIDGET_VISIBLE (child->widget)) continue; GtkRequisition child_req; - gtk_widget_size_request (box_child->widget, &child_req); - - guint prim_length, sec_length; - if (orientation == GTK_ORIENTATION_HORIZONTAL) { - prim_length = child_req.width; - sec_length = child_req.height; - } - else { - prim_length = child_req.height; - sec_length = child_req.width; - } - - if (box_child->ratio) - { - int length = (prim_length * ratios_sum) / box_child->ratio; - box->weight_length = MAX (box->weight_length, length); - } + gtk_widget_size_request (child->widget, &child_req); + if (orientation == GTK_ORIENTATION_HORIZONTAL) + requisition->height = MAX (requisition->height, child_req.height); else - primary_req += prim_length; - primary_req += box_child->padding + box->spacing; - secondary_req = MAX (secondary_req, sec_length); - } - - primary_req += box->weight_length; - - guint border = GTK_CONTAINER (widget)->border_width * 2; - primary_req += border*2; secondary_req += border*2; - - if (orientation == GTK_ORIENTATION_HORIZONTAL) { - requisition->width = primary_req; - requisition->height = secondary_req; - } - else { - requisition->width = secondary_req; - requisition->height = primary_req; + requisition->width = MAX (requisition->width, child_req.width); + children_nb++; } + gint spacing = children_nb ? box->spacing*(children_nb-1) : 0; + if (orientation == GTK_ORIENTATION_HORIZONTAL) + requisition->width += spacing; + else + requisition->height += spacing; } static void ygtk_ratio_box_size_allocate (GtkWidget *widget, @@ -172,163 +128,65 @@ GtkOrientation orientation) { YGtkRatioBox* box = YGTK_RATIO_BOX (widget); - guint border = GTK_CONTAINER (widget)->border_width; - // a first loop to get some data for expansibles (ie. childs with weight) gfloat ratios_sum = 0; - gint expand_num = 0, max_ratio = 0; - gint expansable_length, num_children = 0; - if (orientation == GTK_ORIENTATION_HORIZONTAL) - expansable_length = allocation->width - border*2; - else - expansable_length = allocation->height - border*2; + gint children_nb = 0; - GList* child; - for (child = box->children; child; child = child->next) { - YGtkRatioBoxChild* box_child = (YGtkRatioBoxChild*) child->data; - if (!GTK_WIDGET_VISIBLE (box_child->widget)) + GList* i; + for (i = box->children; i; i = i->next) { + YGtkRatioBoxChild* child = i->data; + if (!GTK_WIDGET_VISIBLE (child->widget)) continue; - if (box_child->expand) - expand_num++; - if (box_child->ratio) - { - ratios_sum += box_child->ratio; - max_ratio = MAX (max_ratio, box_child->ratio); - } - - if (!box_child->ratio) - { - GtkRequisition child_req; - gtk_widget_get_child_requisition (box_child->widget, &child_req); - if (orientation == GTK_ORIENTATION_HORIZONTAL) - expansable_length -= child_req.width; - else - expansable_length -= child_req.height; - } - expansable_length -= box->spacing - box_child->padding; - num_children++; + ratios_sum += child->ratio; + children_nb++; } - expansable_length -= box->weight_length; -/* fprintf (stderr, "%p: expansible length %d allocation %d num children %d\n", - box, expansable_length, - (orientation == GTK_ORIENTATION_HORIZONTAL ? - allocation->width : allocation->height), - num_children); */ - gint child_pos = 0; + gint spacing = children_nb ? box->spacing*(children_nb-1) : 0; + + gint length; if (orientation == GTK_ORIENTATION_HORIZONTAL) - child_pos = allocation->x + border; + length = allocation->width - spacing; else - child_pos = allocation->y + border; + length = allocation->height - spacing; + gint child_pos = 0; - gboolean right_to_left = gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL; - for (child = box->children; child; child = child->next) { - YGtkRatioBoxChild* box_child = (YGtkRatioBoxChild*) child->data; - if (!GTK_WIDGET_VISIBLE (box_child->widget)) + for (i = box->children; i; i = i->next) { + YGtkRatioBoxChild* child = i->data; + if (!GTK_WIDGET_VISIBLE (child->widget)) continue; -/* fprintf (stderr, "%p: ratio box child: ratio %g expand %d must_expand %d " - "xfill %d yfill %d\n", box, - box_child->ratio, box_child->expand, box_child->must_expand, - box_child->xfill, box_child->yfill); */ - - GtkAllocation child_alloc; - gint length; - GtkRequisition child_req; - gtk_widget_get_child_requisition (box_child->widget, &child_req); - - if (!box_child->ratio) - { - if (orientation == GTK_ORIENTATION_HORIZONTAL) - length = child_req.width; - else - length = child_req.height; - } - - // give extra size (honor stretch order) - if (box_child->ratio) - { - int available_length = box->weight_length; - if (!box->has_must_expand) - available_length += expansable_length; - length = (box_child->ratio * available_length) / ratios_sum; - } - else if (box_child->expand && (ratios_sum == 0 || box_child->must_expand)) - { - if (expansable_length > 0) - length += expansable_length / expand_num; - } - - gint spacing_to_next = length + box->spacing + box_child->padding; - if (!box_child->ratio && expansable_length < 0) - { - // oh dear - we can't shrink anything, but we didn't get the size - // we requested this can happen with some large text entry fields. - // try to shrink everything just a bit & hope. Should we shrink - // things marked 'expandable' instead ? - what if there are none ? - double scale; - if (orientation == GTK_ORIENTATION_HORIZONTAL) - scale = (double)(allocation->width + expansable_length) / allocation->width; - else - scale = (double)(allocation->height + expansable_length) / allocation->height; -// fprintf (stderr, "%p: trunc length %d -> %d by scale %g\n", -// box, length, (int) floor (scale * length), scale); - length = floor (scale * length); - spacing_to_next = floor (scale * spacing_to_next); - } + gtk_widget_get_child_requisition (child->widget, &child_req); + gint child_length = (child->ratio * length) / ratios_sum; + GtkAllocation child_alloc; if (orientation == GTK_ORIENTATION_HORIZONTAL) { child_alloc.x = child_pos; - child_alloc.y = allocation->y + border; - child_alloc.width = length; - child_alloc.height = allocation->height - border*2; + child_alloc.y = allocation->y; + child_alloc.width = child_length; + child_alloc.height = allocation->height; } else { // GTK_ORIENTATION_VERTICAL - child_alloc.x = allocation->x + border; + child_alloc.x = allocation->x; child_alloc.y = child_pos; - child_alloc.width = allocation->width - border*2; - child_alloc.height = length; + child_alloc.width = allocation->width; + child_alloc.height = child_length; } - if (!box_child->xfill) { - // we also need to center the widget - gint width = MIN (child_alloc.width, child_req.width); - child_alloc.x += MAX ((child_alloc.width - width) / 2, 0); - child_alloc.width = width; - } - if (!box_child->yfill) { - gint height = MIN (child_alloc.height, child_req.height); - child_alloc.y += MAX ((child_alloc.height - height) / 2, 0); - child_alloc.height = height; - } - - if (right_to_left) - child_alloc.x = allocation->width - child_alloc.x - child_alloc.width; - - gtk_widget_size_allocate (box_child->widget, &child_alloc); - child_pos += spacing_to_next; + gtk_widget_size_allocate (child->widget, &child_alloc); + child_pos += child_length + box->spacing; } } -void ygtk_ratio_box_set_child_packing (YGtkRatioBox *box, GtkWidget *child, - gboolean expand, gboolean must_expand, gfloat ratio, gboolean xfill, gboolean yfill, - guint padding) +void ygtk_ratio_box_set_child_packing (YGtkRatioBox *box, GtkWidget *child, gfloat ratio) { YGtkRatioBoxChild *child_info; child_info = ygtk_ratio_get_child_info (box, child); if (child_info) { gtk_widget_freeze_child_notify (child); - child_info->ratio = ratio; - child_info->xfill = xfill; - child_info->yfill = yfill; - child_info->padding = padding; - child_info->expand = expand; - child_info->must_expand = expand && must_expand; - if (GTK_WIDGET_VISIBLE (child) && GTK_WIDGET_VISIBLE (box)) gtk_widget_queue_resize (child); @@ -336,7 +194,7 @@ } } -void ygtk_ratio_box_set_spacing (YGtkRatioBox *box, gint spacing) +void ygtk_ratio_box_set_spacing (YGtkRatioBox *box, guint spacing) { box->spacing = spacing; } Modified: trunk/gtk/src/ygtkratiobox.h URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkratiobox.h?rev=47992…
============================================================================== --- trunk/gtk/src/ygtkratiobox.h (original) +++ trunk/gtk/src/ygtkratiobox.h Mon Jun 2 16:25:02 2008 @@ -2,33 +2,12 @@ * YaST2-GTK -
http://en.opensuse.org/YaST2-GTK
* ********************************************************************/ -/* YGtkRatioBox is an improvement over the GtkBox container that - allows the programmer to set stretch weights to containees. - - It is similar to GtkBox in usage but instead of feeding an - expand boolean, a weight is given instead. In fact, it should - behave just the same as a GtkBox if you give 0 for not expand - and 1 to. -*/ -/* - Quirks (cause of yast-core): - if one of the children has certain special properties, then only widgets with - the same properties will be expanded. These are, by order: - both stretch and rubber-band - both stretch and weight - weight - stretch - - We use different naming: - stretch = expand - rubber-band or layout-stretch = must expand - weight = ratio +/* YGtkRatioBox uses weights instead of the single state expand boolean. */ #ifndef YGTK_RATIO_BOX_H #define YGTK_RATIO_BOX_H -#include <gdk/gdk.h> #include <gtk/gtkcontainer.h> G_BEGIN_DECLS @@ -50,9 +29,7 @@ // private (read-only): GList *children; - gint16 spacing; - guint weight_length; // min-length for weight widgets - guint has_must_expand : 1; // cache + guint spacing; } YGtkRatioBox; typedef struct _YGtkRatioBoxClass @@ -64,28 +41,15 @@ { GtkWidget *widget; // members - guint16 padding; gfloat ratio; - guint xfill : 1; - guint yfill : 1; - guint expand : 1; // twilight zone flag; use ratio - guint must_expand : 1; // higher order expand } YGtkRatioBoxChild; GType ygtk_ratio_box_get_type (void) G_GNUC_CONST; -void ygtk_ratio_box_set_spacing (YGtkRatioBox *box, gint spacing); - -void ygtk_ratio_box_pack (YGtkRatioBox *box, GtkWidget *child, gfloat ratio, - gboolean xfill, gboolean yfill, guint padding); +void ygtk_ratio_box_set_spacing (YGtkRatioBox *box, guint spacing); -// You can either use ratios or the expand boolean. If some child has a ratio set (to -// a value other than 0), then expand flags will be ignored -- use must_expand in such -// cases, when you want a child to expand like the child of the most ratio. -// (rules based on those of libyui -- check top) -void ygtk_ratio_box_set_child_packing (YGtkRatioBox *box, GtkWidget *child, - gboolean expand, gboolean must_expand, gfloat ratio, gboolean xfill, gboolean yfill, - guint padding); +void ygtk_ratio_box_pack (YGtkRatioBox *box, GtkWidget *child, gfloat ratio); +void ygtk_ratio_box_set_child_packing (YGtkRatioBox *box, GtkWidget *child, gfloat ratio); /* RatioHBox */ -- To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
0
0
[yast-commit] r47991 - in /trunk/network: package/yast2-network.changes src/modules/DNS.ycp src/modules/Host.ycp
by mzugec@svn.opensuse.org
02 Jun '08
02 Jun '08
Author: mzugec Date: Mon Jun 2 16:19:59 2008 New Revision: 47991 URL:
http://svn.opensuse.org/viewcvs/yast?rev=47991&view=rev
Log: removed html tags in progress bar Modified: trunk/network/package/yast2-network.changes trunk/network/src/modules/DNS.ycp trunk/network/src/modules/Host.ycp Modified: trunk/network/package/yast2-network.changes URL:
http://svn.opensuse.org/viewcvs/yast/trunk/network/package/yast2-network.ch…
============================================================================== --- trunk/network/package/yast2-network.changes (original) +++ trunk/network/package/yast2-network.changes Mon Jun 2 16:19:59 2008 @@ -1,4 +1,9 @@ ------------------------------------------------------------------- +Mon Jun 2 16:19:15 CEST 2008 - mzugec(a)suse.cz + +- removed html tags in progress bar (bnc#393966) + +------------------------------------------------------------------- Mon Jun 2 09:21:09 CEST 2008 - mzugec(a)suse.cz - set link status up for all interfaces during installation Modified: trunk/network/src/modules/DNS.ycp URL:
http://svn.opensuse.org/viewcvs/yast/trunk/network/src/modules/DNS.ycp?rev=…
============================================================================== --- trunk/network/src/modules/DNS.ycp (original) +++ trunk/network/src/modules/DNS.ycp Mon Jun 2 16:19:59 2008 @@ -309,7 +309,7 @@ if( update_resolv ) { /* Progress step 3/3 */ - ProgressNextStage(_("Updating <tt>/etc/resolv.conf</tt>...")); + ProgressNextStage(_("Updating /etc/resolv.conf ...")); /* update /etc/resolv.conf */ SCR::Write(.etc.resolv_conf.search, searchlist); Modified: trunk/network/src/modules/Host.ycp URL:
http://svn.opensuse.org/viewcvs/yast/trunk/network/src/modules/Host.ycp?rev…
============================================================================== --- trunk/network/src/modules/Host.ycp (original) +++ trunk/network/src/modules/Host.ycp Mon Jun 2 16:19:59 2008 @@ -104,7 +104,7 @@ Progress::New(caption, " ", size(steps), steps, [], ""); - ProgressNextStage(_("Updating <tt>/etc/hosts</tt>...")); + ProgressNextStage(_("Updating /etc/hosts ...")); /* Create if not exists, otherwise backup */ if(SCR::Read(.target.size, hosts_file) < 0) -- To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
0
0
[yast-commit] r47990 - /trunk/qt/src/QY2ListView.cc
by sh-sh-sh@svn.opensuse.org
02 Jun '08
02 Jun '08
Author: sh-sh-sh Date: Mon Jun 2 14:39:06 2008 New Revision: 47990 URL:
http://svn.opensuse.org/viewcvs/yast?rev=47990&view=rev
Log: use #if, not comments to disable code Modified: trunk/qt/src/QY2ListView.cc Modified: trunk/qt/src/QY2ListView.cc URL:
http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/QY2ListView.cc?rev=47990&…
============================================================================== --- trunk/qt/src/QY2ListView.cc (original) +++ trunk/qt/src/QY2ListView.cc Mon Jun 2 14:39:06 2008 @@ -447,7 +447,8 @@ } -/* + +#if FIXME_ITEM_COLORS void QY2CheckListItem::paintCell( QPainter * painter, const QColorGroup & colorGroup, @@ -462,7 +463,8 @@ QTreeWidgetItem::paintCell( painter, cg, column, width, alignment ); } -*/ +#endif + #if FIXME_TOOLTIP void -- To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
0
0
[yast-commit] r47989 - /trunk/qt/src/YQTree.cc
by sh-sh-sh@svn.opensuse.org
02 Jun '08
02 Jun '08
Author: sh-sh-sh Date: Mon Jun 2 14:38:44 2008 New Revision: 47989 URL:
http://svn.opensuse.org/viewcvs/yast?rev=47989&view=rev
Log: excess whitespace Modified: trunk/qt/src/YQTree.cc Modified: trunk/qt/src/YQTree.cc URL:
http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/YQTree.cc?rev=47989&r1=47…
============================================================================== --- trunk/qt/src/YQTree.cc (original) +++ trunk/qt/src/YQTree.cc Mon Jun 2 14:38:44 2008 @@ -51,11 +51,11 @@ setWidgetRep( this ); layout->setSpacing( YQWidgetSpacing ); - layout->setMargin ( YQWidgetMargin ); + layout->setMargin ( YQWidgetMargin ); _nextSerialNo = 0; - _caption = new YQWidgetCaption( this, label ); + _caption = new YQWidgetCaption( this, label ); YUI_CHECK_NEW( _caption ); layout->addWidget( _caption ); @@ -72,17 +72,17 @@ _caption->setBuddy ( _qt_treeWidget ); connect( _qt_treeWidget, SIGNAL( itemSelectionChanged () ), - this, SLOT ( slotSelectionChanged () ) ); + this, SLOT ( slotSelectionChanged () ) ); connect( _qt_treeWidget, SIGNAL( itemActivated ( QTreeWidgetItem *, int ) ), - this, SLOT ( slotActivated ( QTreeWidgetItem * ) ) ); + this, SLOT ( slotActivated ( QTreeWidgetItem * ) ) ); connect( _qt_treeWidget, SIGNAL( itemDoubleClicked( QTreeWidgetItem *, int ) ), - this, SLOT ( slotActivated ( QTreeWidgetItem * ) ) ); + this, SLOT ( slotActivated ( QTreeWidgetItem * ) ) ); connect( _qt_treeWidget, SIGNAL( itemExpanded ( QTreeWidgetItem * ) ), this, SLOT ( slotItemExpanded ( QTreeWidgetItem * ) ) ); - + connect( _qt_treeWidget, SIGNAL( itemCollapsed ( QTreeWidgetItem * ) ), this, SLOT ( slotItemCollapsed( QTreeWidgetItem * ) ) ); } @@ -249,7 +249,7 @@ int YQTree::preferredHeight() { int hintHeight = !_caption->isHidden() ? _caption->sizeHint().height() : 0; - + // 300 is an arbitrary value. Use a MinSize or MinHeight widget to set a // size that is useful for the application. -- To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
0
0
[yast-commit] r47988 - in /trunk/theme/openSUSE/icons: 22x22/apps/yast-SMT.png 32x32/apps/yast-SMT.png 48x48/apps/yast-SMT.png
by jimmacfx@svn.opensuse.org
02 Jun '08
02 Jun '08
Author: jimmacfx Date: Mon Jun 2 14:20:56 2008 New Revision: 47988 URL:
http://svn.opensuse.org/viewcvs/yast?rev=47988&view=rev
Log: SMT icon. Addresses bug #390156 Added: trunk/theme/openSUSE/icons/22x22/apps/yast-SMT.png trunk/theme/openSUSE/icons/32x32/apps/yast-SMT.png trunk/theme/openSUSE/icons/48x48/apps/yast-SMT.png Added: trunk/theme/openSUSE/icons/22x22/apps/yast-SMT.png URL:
http://svn.opensuse.org/viewcvs/yast/trunk/theme/openSUSE/icons/22x22/apps/…
============================================================================== Files trunk/theme/openSUSE/icons/22x22/apps/yast-SMT.png (added) and trunk/theme/openSUSE/icons/22x22/apps/yast-SMT.png Mon Jun 2 14:20:56 2008 differ Added: trunk/theme/openSUSE/icons/32x32/apps/yast-SMT.png URL:
http://svn.opensuse.org/viewcvs/yast/trunk/theme/openSUSE/icons/32x32/apps/…
============================================================================== Files trunk/theme/openSUSE/icons/32x32/apps/yast-SMT.png (added) and trunk/theme/openSUSE/icons/32x32/apps/yast-SMT.png Mon Jun 2 14:20:56 2008 differ Added: trunk/theme/openSUSE/icons/48x48/apps/yast-SMT.png URL:
http://svn.opensuse.org/viewcvs/yast/trunk/theme/openSUSE/icons/48x48/apps/…
============================================================================== Files trunk/theme/openSUSE/icons/48x48/apps/yast-SMT.png (added) and trunk/theme/openSUSE/icons/48x48/apps/yast-SMT.png Mon Jun 2 14:20:56 2008 differ -- To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
0
0
← Newer
1
...
66
67
68
69
70
71
72
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
Results per page:
10
25
50
100
200