YaST Commits
Threads by month
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- 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
July 2011
- 19 participants
- 410 discussions
[yast-commit] r64993 - /tags/branch-Code-11-SP2-2_17_19/sound/
by lslezak@svn2.opensuse.org 25 Jul '11
by lslezak@svn2.opensuse.org 25 Jul '11
25 Jul '11
Author: lslezak
Date: Mon Jul 25 16:24:12 2011
New Revision: 64993
URL: http://svn.opensuse.org/viewcvs/yast?rev=64993&view=rev
Log:
Created tag branch-Code-11-SP2-2_17_19 for sound
Added:
tags/branch-Code-11-SP2-2_17_19/sound/ (props changed)
- copied from r64992, branches/SuSE-Code-11-SP2-Branch/sound/
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r64992 - in /branches/SuSE-Code-11-SP2-Branch/sound: VERSION package/yast2-sound.changes sound/src/routines.ycp
by lslezak@svn2.opensuse.org 25 Jul '11
by lslezak@svn2.opensuse.org 25 Jul '11
25 Jul '11
Author: lslezak
Date: Mon Jul 25 16:01:03 2011
New Revision: 64992
URL: http://svn.opensuse.org/viewcvs/yast?rev=64992&view=rev
Log:
- fixed hwinfo driver name conversion, fixed detection of sound
cards missing in the sound card database (bnc#706992)
- 2.17.19
Modified:
branches/SuSE-Code-11-SP2-Branch/sound/VERSION
branches/SuSE-Code-11-SP2-Branch/sound/package/yast2-sound.changes
branches/SuSE-Code-11-SP2-Branch/sound/sound/src/routines.ycp
Modified: branches/SuSE-Code-11-SP2-Branch/sound/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/sound…
==============================================================================
--- branches/SuSE-Code-11-SP2-Branch/sound/VERSION (original)
+++ branches/SuSE-Code-11-SP2-Branch/sound/VERSION Mon Jul 25 16:01:03 2011
@@ -1 +1 @@
-2.17.18
+2.17.19
Modified: branches/SuSE-Code-11-SP2-Branch/sound/package/yast2-sound.changes
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/sound…
==============================================================================
--- branches/SuSE-Code-11-SP2-Branch/sound/package/yast2-sound.changes (original)
+++ branches/SuSE-Code-11-SP2-Branch/sound/package/yast2-sound.changes Mon Jul 25 16:01:03 2011
@@ -1,4 +1,11 @@
-------------------------------------------------------------------
+Mon Jul 25 13:36:08 UTC 2011 - lslezak(a)suse.cz
+
+- fixed hwinfo driver name conversion, fixed detection of sound
+ cards missing in the sound card database (bnc#706992)
+- 2.17.19
+
+-------------------------------------------------------------------
Thu Jul 7 15:09:01 UTC 2011 - lslezak(a)suse.cz
- updated sound card database (kernel 2.6.32.41-0.5)
Modified: branches/SuSE-Code-11-SP2-Branch/sound/sound/src/routines.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/sound…
==============================================================================
--- branches/SuSE-Code-11-SP2-Branch/sound/sound/src/routines.ycp (original)
+++ branches/SuSE-Code-11-SP2-Branch/sound/sound/src/routines.ycp Mon Jul 25 16:01:03 2011
@@ -678,11 +678,8 @@
// use value from hwinfo if present
modname = card["drivers",0,"modules",0,0]:"";
- // covert module name - hwinfo might use _ in module name prefix (e.g. snd_via82xx)
- if (substring(modname, 0, size("snd_")) == "snd_")
- {
- modname = "snd-" + substring(modname, size("snd_"));
- }
+ // convert module name - hwinfo might use _ in module name prefix (e.g. snd_via82xx)
+ modname = mergestring(splitstring(modname,"_"),"-");
if (modname != "")
{
@@ -705,7 +702,7 @@
map ret = Sound::db_modules [modname]:$[];
- if (ret != $[] && !haskey(ret, "name"))
+ if (!haskey(ret, "name"))
{
// we must supply the 'name' key with the module name
ret = add(ret, "name", modname);
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r64991 - in /trunk/ruby-bindings: VERSION.cmake package/yast2-ruby-bindings.changes
by kkaempf@svn2.opensuse.org 25 Jul '11
by kkaempf@svn2.opensuse.org 25 Jul '11
25 Jul '11
Author: kkaempf
Date: Mon Jul 25 15:30:08 2011
New Revision: 64991
URL: http://svn.opensuse.org/viewcvs/yast?rev=64991&view=rev
Log:
bump to 0.3.6
Modified:
trunk/ruby-bindings/VERSION.cmake
trunk/ruby-bindings/package/yast2-ruby-bindings.changes
Modified: trunk/ruby-bindings/VERSION.cmake
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ruby-bindings/VERSION.cmake?rev=…
==============================================================================
--- trunk/ruby-bindings/VERSION.cmake (original)
+++ trunk/ruby-bindings/VERSION.cmake Mon Jul 25 15:30:08 2011
@@ -1,3 +1,3 @@
SET(VERSION_MAJOR "0")
SET(VERSION_MINOR "3")
-SET(VERSION_PATCH "5")
+SET(VERSION_PATCH "6")
Modified: trunk/ruby-bindings/package/yast2-ruby-bindings.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ruby-bindings/package/yast2-ruby…
==============================================================================
--- trunk/ruby-bindings/package/yast2-ruby-bindings.changes (original)
+++ trunk/ruby-bindings/package/yast2-ruby-bindings.changes Mon Jul 25 15:30:08 2011
@@ -1,4 +1,11 @@
-------------------------------------------------------------------
+Mon Jul 25 13:28:56 UTC 2011 - kkaempf(a)novell.com
+
+- wrap rb_funcall in rb_protect to prevent segfaults if the
+ calling function raises an exception (bnc#705425)
+- 0.3.6
+
+-------------------------------------------------------------------
Tue Nov 3 12:43:21 UTC 2009 - dmacvicar(a)novell.com
- support for nested namespaces (Foo::Bar)
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r64990 - /trunk/ruby-bindings/src/ruby/YRuby.cc
by kkaempf@svn2.opensuse.org 25 Jul '11
by kkaempf@svn2.opensuse.org 25 Jul '11
25 Jul '11
Author: kkaempf
Date: Mon Jul 25 15:25:44 2011
New Revision: 64990
URL: http://svn.opensuse.org/viewcvs/yast?rev=64990&view=rev
Log:
simplify call to require().
Just call rb_require instead of rb_eval_string("require ...")
Modified:
trunk/ruby-bindings/src/ruby/YRuby.cc
Modified: trunk/ruby-bindings/src/ruby/YRuby.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ruby-bindings/src/ruby/YRuby.cc?…
==============================================================================
--- trunk/ruby-bindings/src/ruby/YRuby.cc (original)
+++ trunk/ruby-bindings/src/ruby/YRuby.cc Mon Jul 25 15:25:44 2011
@@ -126,9 +126,7 @@
string module_name = argList->value(0)->asString()->value();
string module_path = argList->value(1)->asString()->value();
//y2milestone("loadModule 3: '%s'", module_name.c_str());
- string require_module = "require(\"" + module_path + "\")";
- //y2milestone("loadModule 3.5");
- VALUE result = rb_eval_string((require_module).c_str());
+ VALUE result = rb_require(module_path.c_str());
if ( result == Qfalse )
return YCPError( "Ruby::loadModule() / Can't load ruby module '" + module_path + "'" );
//y2milestone("loadModule 4");
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r64989 - /trunk/ruby-bindings/src/ruby/YRuby.cc
by kkaempf@svn2.opensuse.org 25 Jul '11
by kkaempf@svn2.opensuse.org 25 Jul '11
25 Jul '11
Author: kkaempf
Date: Mon Jul 25 15:23:02 2011
New Revision: 64989
URL: http://svn.opensuse.org/viewcvs/yast?rev=64989&view=rev
Log:
wrap rb_funcall() with rb_protect so exception can be thrown.
Will segfault without it.
+ print a nice exception trace to y2log in case of error.
Modified:
trunk/ruby-bindings/src/ruby/YRuby.cc
Modified: trunk/ruby-bindings/src/ruby/YRuby.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ruby-bindings/src/ruby/YRuby.cc?…
==============================================================================
--- trunk/ruby-bindings/src/ruby/YRuby.cc (original)
+++ trunk/ruby-bindings/src/ruby/YRuby.cc Mon Jul 25 15:23:02 2011
@@ -20,6 +20,7 @@
*/
#include <stdlib.h>
+#include <stdarg.h>
#include <list>
#include <iosfwd>
#include <sstream>
@@ -135,6 +136,40 @@
}
+// snprintf into a temp string
+static char *
+fmtstr(const char* fmt, ...)
+{
+ va_list ap;
+ int len;
+ char* str;
+
+ va_start(ap, fmt);
+ len = vsnprintf(NULL, 0, fmt, ap);
+ va_end(ap);
+ if (len <= 0)
+ {
+ return NULL;
+ }
+ str = (char*)malloc(len+1);
+ if (str == NULL)
+ {
+ return NULL;
+ }
+ va_start(ap, fmt);
+ vsnprintf(str, len+1, fmt, ap);
+ va_end(ap);
+ return str;
+}
+
+
+// rb_protect-enabled rb_funcall, see below
+static VALUE
+protected_call(VALUE args)
+{
+ VALUE *values = (VALUE *)args;
+ return rb_funcall3(values[0], values[1], (int)values[2], values+3);
+}
/**
* @param argList arguments start 1!, 0 is dummy
@@ -155,20 +190,39 @@
// make rooms for size-1 arguments to
// the ruby function
- VALUE values[size-1];
+ // +3 for module, function, and number of args
+ // to pass to protected_call()
+ VALUE values[size-1+3];
+ int error;
int i=0;
for ( ; i < size-1; ++i )
{
// get the
YCPValue v = argList->value(i+1);
y2milestone("Adding argument %d of type %s", i, v->valuetype_str());
- values[i] = ycpvalue_2_rbvalue(v);
+ values[i+3] = ycpvalue_2_rbvalue(v);
}
- y2milestone( "Wll call function '%s' in module '%s' with '%d' arguments", function.c_str(), module_name.c_str(), size-1);
- VALUE result = rb_funcall2( module, rb_intern(function.c_str()), size-1, values );
+ y2milestone( "Will call function '%s' in module '%s' with '%d' arguments", function.c_str(), module_name.c_str(), size-1);
+ values[0] = module;
+ values[1] = rb_intern(function.c_str());
+ values[2] = size-1;
+ VALUE result = rb_protect(protected_call, (VALUE)values, &error);
+ if (error)
+ {
+ VALUE exception = rb_gv_get("$!"); /* get last exception */
+ VALUE reason = rb_funcall(exception, rb_intern("to_s"), 0 );
+ VALUE trace = rb_gv_get("$@"); /* get last exception trace */
+ VALUE backtrace = rb_funcall(trace, rb_intern("join"), 1, rb_str_new("\n\t", 2));
+
+ char* tmp = fmtstr("%s\n\t%s", StringValuePtr(reason), StringValuePtr(backtrace));
+ y2error("%s.%s failed\n%s", module_name.c_str(), function.c_str(), tmp);
+ }
+ else
+ {
//VALUE result = rb_funcall( module, rb_intern(function.c_str()), 2, INT2NUM(2), INT2NUM(3) );
- y2milestone( "Called function '%s' in module '%s'", function.c_str(), module_name.c_str());
+ y2milestone( "Called function '%s' in module '%s'", function.c_str(), module_name.c_str());
+ }
return rbvalue_2_ycpvalue(result);
}
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
25 Jul '11
Author: locilka
Date: Mon Jul 25 15:08:32 2011
New Revision: 64988
URL: http://svn.opensuse.org/viewcvs/yast?rev=64988&view=rev
Log:
Created tag stable-2_21_0 for firstboot
Added:
tags/stable-2_21_0/firstboot/
- copied from r64987, trunk/firstboot/
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r64987 - in /trunk/firstboot: VERSION package/yast2-firstboot.changes
by locilka@svn2.opensuse.org 25 Jul '11
by locilka@svn2.opensuse.org 25 Jul '11
25 Jul '11
Author: locilka
Date: Mon Jul 25 15:00:21 2011
New Revision: 64987
URL: http://svn.opensuse.org/viewcvs/yast?rev=64987&view=rev
Log:
New version
Modified:
trunk/firstboot/VERSION
trunk/firstboot/package/yast2-firstboot.changes
Modified: trunk/firstboot/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/trunk/firstboot/VERSION?rev=64987&r1=6…
==============================================================================
--- trunk/firstboot/VERSION (original)
+++ trunk/firstboot/VERSION Mon Jul 25 15:00:21 2011
@@ -1 +1 @@
-2.20.2
+2.21.0
Modified: trunk/firstboot/package/yast2-firstboot.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/firstboot/package/yast2-firstboo…
==============================================================================
--- trunk/firstboot/package/yast2-firstboot.changes (original)
+++ trunk/firstboot/package/yast2-firstboot.changes Mon Jul 25 15:00:21 2011
@@ -3,6 +3,7 @@
- Removed obsoleted X-KDE-SubstituteUID from desktop file
(bnc#540627)
+- 2.21.0
-------------------------------------------------------------------
Fri Feb 18 11:28:57 CET 2011 - jsuchome(a)suse.cz
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
25 Jul '11
Author: locilka
Date: Mon Jul 25 14:55:01 2011
New Revision: 64986
URL: http://svn.opensuse.org/viewcvs/yast?rev=64986&view=rev
Log:
Created tag stable-2_21_8 for installation
Added:
tags/stable-2_21_8/installation/
- copied from r64985, trunk/installation/
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r64985 - in /trunk/installation: VERSION package/yast2-installation.changes
by locilka@svn2.opensuse.org 25 Jul '11
by locilka@svn2.opensuse.org 25 Jul '11
25 Jul '11
Author: locilka
Date: Mon Jul 25 14:54:23 2011
New Revision: 64985
URL: http://svn.opensuse.org/viewcvs/yast?rev=64985&view=rev
Log:
New version
Modified:
trunk/installation/VERSION
trunk/installation/package/yast2-installation.changes
Modified: trunk/installation/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/trunk/installation/VERSION?rev=64985&r…
==============================================================================
--- trunk/installation/VERSION (original)
+++ trunk/installation/VERSION Mon Jul 25 14:54:23 2011
@@ -1 +1 @@
-2.21.7
+2.21.8
Modified: trunk/installation/package/yast2-installation.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/installation/package/yast2-insta…
==============================================================================
--- trunk/installation/package/yast2-installation.changes (original)
+++ trunk/installation/package/yast2-installation.changes Mon Jul 25 14:54:23 2011
@@ -3,6 +3,7 @@
- Removed obsoleted X-KDE-SubstituteUID from deploy_image.desktop
(bnc#540627)
+- 2.21.8
-------------------------------------------------------------------
Tue Jul 12 15:34:38 CEST 2011 - jsuchome(a)suse.cz
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
25 Jul '11
Author: locilka
Date: Mon Jul 25 14:15:41 2011
New Revision: 64984
URL: http://svn.opensuse.org/viewcvs/yast?rev=64984&view=rev
Log:
Created tag stable-0_8_12 for metapackage
Added:
tags/stable-0_8_12/metapackage/
- copied from r64983, trunk/metapackage/
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
Author: locilka
Date: Mon Jul 25 14:15:39 2011
New Revision: 64983
URL: http://svn.opensuse.org/viewcvs/yast?rev=64983&view=rev
Log:
Created tag stable-0_8_12
Added:
tags/stable-0_8_12/
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r64982 - in /trunk/metapackage: VERSION package/yast2-metapackage-handler.changes
by locilka@svn2.opensuse.org 25 Jul '11
by locilka@svn2.opensuse.org 25 Jul '11
25 Jul '11
Author: locilka
Date: Mon Jul 25 14:15:28 2011
New Revision: 64982
URL: http://svn.opensuse.org/viewcvs/yast?rev=64982&view=rev
Log:
New version
Modified:
trunk/metapackage/VERSION
trunk/metapackage/package/yast2-metapackage-handler.changes
Modified: trunk/metapackage/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/trunk/metapackage/VERSION?rev=64982&r1…
==============================================================================
--- trunk/metapackage/VERSION (original)
+++ trunk/metapackage/VERSION Mon Jul 25 14:15:28 2011
@@ -1 +1 @@
-0.8.11
+0.8.12
Modified: trunk/metapackage/package/yast2-metapackage-handler.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/metapackage/package/yast2-metapa…
==============================================================================
--- trunk/metapackage/package/yast2-metapackage-handler.changes (original)
+++ trunk/metapackage/package/yast2-metapackage-handler.changes Mon Jul 25 14:15:28 2011
@@ -3,6 +3,7 @@
- removed X-KDE-SubstituteUID from the desktop file and replaced
with X-SuSE-YaST-RootOnly (bnc#540627)
+- 0.8.12
-------------------------------------------------------------------
Fri Oct 15 11:34:00 UTC 2010 - lslezak(a)suse.cz
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
25 Jul '11
Author: lslezak
Date: Mon Jul 25 13:33:28 2011
New Revision: 64981
URL: http://svn.opensuse.org/viewcvs/yast?rev=64981&view=rev
Log:
Created tag stable-2_21_6 for packager
Added:
tags/stable-2_21_6/packager/ (props changed)
- copied from r64980, trunk/packager/
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r64980 - in /trunk/packager: VERSION package/yast2-packager.changes src/config/ src/config/webpin.desktop
by lslezak@svn2.opensuse.org 25 Jul '11
by lslezak@svn2.opensuse.org 25 Jul '11
25 Jul '11
Author: lslezak
Date: Mon Jul 25 13:33:21 2011
New Revision: 64980
URL: http://svn.opensuse.org/viewcvs/yast?rev=64980&view=rev
Log:
- removed trailing white space in webpin.desktop file (bnc#707984)
- 2.21.6
Modified:
trunk/packager/VERSION
trunk/packager/package/yast2-packager.changes
trunk/packager/src/config/ (props changed)
trunk/packager/src/config/webpin.desktop
Modified: trunk/packager/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/trunk/packager/VERSION?rev=64980&r1=64…
==============================================================================
--- trunk/packager/VERSION (original)
+++ trunk/packager/VERSION Mon Jul 25 13:33:21 2011
@@ -1 +1 @@
-2.21.5
+2.21.6
Modified: trunk/packager/package/yast2-packager.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/packager/package/yast2-packager.…
==============================================================================
--- trunk/packager/package/yast2-packager.changes (original)
+++ trunk/packager/package/yast2-packager.changes Mon Jul 25 13:33:21 2011
@@ -1,4 +1,10 @@
-------------------------------------------------------------------
+Mon Jul 25 11:22:05 UTC 2011 - lslezak(a)suse.cz
+
+- removed trailing white space in webpin.desktop file (bnc#707984)
+- 2.21.6
+
+-------------------------------------------------------------------
Fri Jul 22 15:09:22 CEST 2011 - locilka(a)suse.cz
- Removed obsoleted X-KDE-SubstituteUID from desktop file
Modified: trunk/packager/src/config/webpin.desktop
URL: http://svn.opensuse.org/viewcvs/yast/trunk/packager/src/config/webpin.deskt…
==============================================================================
--- trunk/packager/src/config/webpin.desktop (original)
+++ trunk/packager/src/config/webpin.desktop Mon Jul 25 13:33:21 2011
@@ -16,9 +16,9 @@
X-SuSE-YaST-SortKey=
X-SuSE-YaST-AutoInstResource=
-Icon=yast-webpin
+Icon=yast-webpin
Exec=xdg-su -c "/sbin/yast2 webpin_package_search"
Name=Package Search (webpin)
-GenericName=Search for software in online repositories
+GenericName=Search for software in online repositories
StartupNotify=true
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r64979 - in /trunk/control-center-gnome: ./ etc/ src/
by vuntz@svn2.opensuse.org 25 Jul '11
by vuntz@svn2.opensuse.org 25 Jul '11
25 Jul '11
Author: vuntz
Date: Mon Jul 25 12:21:36 2011
New Revision: 64979
URL: http://svn.opensuse.org/viewcvs/yast?rev=64979&view=rev
Log:
2011-07-25 Vincent Untz <vuntz(a)gnome.org>
Release 2.21.0
Completely rewrite: this is now a fork of the shell of
gnome-control-center in GNOME 3. The code should be kept in sync with
the upstream code; gnome-control-center.patch can be used as a basis for
this.
* VERSION: bump version.
* gnome-control-center.patch: patch that is applied to the
gnome-control-center shell to get the code in src/.
* configure.in.in: update dependencies (gconf-2.0, libslab, unique-1.0
are gone, we now depend on gio-unix-2.0, gtk+-3.0,
libgnome-control-center, libgnome-menu).
* etc/yast2-control-center-gnome.schemas.in, etc/Makefile.am: drop gconf
schema, since we don't use it anymore.
* src/*: everything is changed.
Added:
trunk/control-center-gnome/gnome-control-center.patch
trunk/control-center-gnome/src/cc-shell-category-view.c
trunk/control-center-gnome/src/cc-shell-category-view.h
trunk/control-center-gnome/src/cc-shell-item-view.c
trunk/control-center-gnome/src/cc-shell-item-view.h
trunk/control-center-gnome/src/cc-shell-log.c
trunk/control-center-gnome/src/cc-shell-log.h
trunk/control-center-gnome/src/cc-shell-marshal.list
trunk/control-center-gnome/src/cc-shell-model.c
trunk/control-center-gnome/src/cc-shell-model.h
trunk/control-center-gnome/src/gnome-control-center.c
trunk/control-center-gnome/src/gnome-control-center.h
trunk/control-center-gnome/src/shell-search-renderer.c
trunk/control-center-gnome/src/shell-search-renderer.h
trunk/control-center-gnome/src/shell.ui
Removed:
trunk/control-center-gnome/etc/yast2-control-center-gnome.schemas.in
Modified:
trunk/control-center-gnome/ChangeLog
trunk/control-center-gnome/VERSION
trunk/control-center-gnome/configure.in.in
trunk/control-center-gnome/etc/Makefile.am
trunk/control-center-gnome/src/Makefile.am
trunk/control-center-gnome/src/control-center.c
Modified: trunk/control-center-gnome/ChangeLog
URL: http://svn.opensuse.org/viewcvs/yast/trunk/control-center-gnome/ChangeLog?r…
==============================================================================
--- trunk/control-center-gnome/ChangeLog (original)
+++ trunk/control-center-gnome/ChangeLog Mon Jul 25 12:21:36 2011
@@ -1,3 +1,22 @@
+2011-07-25 Vincent Untz <vuntz(a)gnome.org>
+
+ Release 2.21.0
+
+ Completely rewrite: this is now a fork of the shell of
+ gnome-control-center in GNOME 3. The code should be kept in sync with
+ the upstream code; gnome-control-center.patch can be used as a basis for
+ this.
+
+ * VERSION: bump version.
+ * gnome-control-center.patch: patch that is applied to the
+ gnome-control-center shell to get the code in src/.
+ * configure.in.in: update dependencies (gconf-2.0, libslab, unique-1.0
+ are gone, we now depend on gio-unix-2.0, gtk+-3.0,
+ libgnome-control-center, libgnome-menu).
+ * etc/yast2-control-center-gnome.schemas.in, etc/Makefile.am: drop gconf
+ schema, since we don't use it anymore.
+ * src/*: everything is changed.
+
2010-03-28 Cong Meng <cmeng(a)novell.com>
Add a new category High Availability. (bnc #575787)
Modified: trunk/control-center-gnome/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/trunk/control-center-gnome/VERSION?rev…
==============================================================================
--- trunk/control-center-gnome/VERSION (original)
+++ trunk/control-center-gnome/VERSION Mon Jul 25 12:21:36 2011
@@ -1 +1 @@
-2.13.4
+2.21.0
Modified: trunk/control-center-gnome/configure.in.in
URL: http://svn.opensuse.org/viewcvs/yast/trunk/control-center-gnome/configure.i…
==============================================================================
--- trunk/control-center-gnome/configure.in.in (original)
+++ trunk/control-center-gnome/configure.in.in Mon Jul 25 12:21:36 2011
@@ -11,19 +11,17 @@
dnl ==============================================
dnl Check that we meet the dependencies
dnl ==============================================
-AM_PATH_GLIB_2_0(2.8.0,,,gobject)
+AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal, no)
-PKG_CHECK_MODULES(CONTROL, libslab >= 2.27.1 unique-1.0)
-AC_SUBST(CONTROL_CFLAGS)
-AC_SUBST(CONTROL_LIBS)
-
-AC_PATH_PROG(GCONFTOOL, gconftool-2, no)
-
-if test x"$GCONFTOOL" = xno; then
- AC_MSG_ERROR([gconftool-2 executable was not found in your path - should be install with gconf])
+if test x"$GLIB_GENMARSHAL" = xno; then
+ AC_MSG_ERROR([glib-genmarshal executable not found in your path - should be installed with glib])
fi
-AM_GCONF_SOURCE_2
+AC_SUBST(GLIB_GENMARSHAL)
+
+PKG_CHECK_MODULES(CONTROL, gtk+-3.0 libgnome-menu gio-unix-2.0 libgnome-control-center > 3.0)
+AC_SUBST(CONTROL_CFLAGS)
+AC_SUBST(CONTROL_LIBS)
## and generate the output
@YAST2-OUTPUT@
Modified: trunk/control-center-gnome/etc/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/trunk/control-center-gnome/etc/Makefil…
==============================================================================
--- trunk/control-center-gnome/etc/Makefile.am (original)
+++ trunk/control-center-gnome/etc/Makefile.am Mon Jul 25 12:21:36 2011
@@ -1,6 +1,3 @@
-schemasdir = @GCONF_SCHEMA_FILE_DIR@
-schemas_DATA = yast2-control-center-gnome.schemas
-
# hacks
menudir = $(sysconfdir)/xdg/menus
menu_DATA = YaST-gnome.menu
@@ -9,16 +6,4 @@
directorydir = $(datadir)/desktop-directories
directory_DATA = $(wildcard yast-gnome-*.directory)
-$(schemas_DATA): $(schemas_DATA).in
- sed -e "s|\@DATADIR\@|$(datadir)|g" $< > $@
-
-install-data-local:
- if test -z "$(DESTDIR)" ; then \
- for p in $(schemas_DATA) ; do \
- GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-install-rule $$p; \
- done \
- fi
-
-EXTRA_DIST = $(schemas_DATA).in $(menu_DATA) $(directory_DATA)
-
-CLEANFILES = $(schemas_DATA)
+EXTRA_DIST = $(menu_DATA) $(directory_DATA)
Added: trunk/control-center-gnome/gnome-control-center.patch
URL: http://svn.opensuse.org/viewcvs/yast/trunk/control-center-gnome/gnome-contr…
==============================================================================
--- trunk/control-center-gnome/gnome-control-center.patch (added)
+++ trunk/control-center-gnome/gnome-control-center.patch Mon Jul 25 12:21:36 2011
@@ -0,0 +1,243 @@
+commit 9515576b680d86c78f5c5e100b22c0e71e71b738
+Author: Vincent Untz <vuntz(a)gnome.org>
+Date: Mon Jul 25 11:38:26 2011 +0200
+
+ shell: change to YaST shell
+
+diff --git a/shell/cc-shell-category-view.c b/shell/cc-shell-category-view.c
+index b2a5ee4..57ad8d4 100644
+--- a/shell/cc-shell-category-view.c
++++ b/shell/cc-shell-category-view.c
+@@ -20,7 +20,7 @@
+
+ #include "cc-shell-category-view.h"
+ #include "cc-shell-item-view.h"
+-#include "cc-shell.h"
++#include <libgnome-control-center/cc-shell.h>
+ #include "cc-shell-model.h"
+
+ G_DEFINE_TYPE (CcShellCategoryView, cc_shell_category_view, GTK_TYPE_FRAME)
+diff --git a/shell/control-center.c b/shell/control-center.c
+index 2ba41fd..09aec0f 100644
+--- a/shell/control-center.c
++++ b/shell/control-center.c
+@@ -41,8 +41,10 @@ option_version_cb (const gchar *option_name,
+ exit (0);
+ }
+
++#if 0
+ static char **start_panels = NULL;
+ static gboolean show_overview = FALSE;
++#endif
+ static gboolean verbose = FALSE;
+ static gboolean show_help = FALSE;
+ static gboolean show_help_gtk = FALSE;
+@@ -51,11 +53,15 @@ static gboolean show_help_all = FALSE;
+ const GOptionEntry all_options[] = {
+ { "version", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, option_version_cb, NULL, NULL },
+ { "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose, N_("Enable verbose mode"), NULL },
++#if 0
+ { "overview", 'o', 0, G_OPTION_ARG_NONE, &show_overview, N_("Show the overview"), NULL },
++#endif
+ { "help", 'h', G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_NONE, &show_help, N_("Show help options"), NULL },
+ { "help-all", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_NONE, &show_help_all, N_("Show help options"), NULL },
+ { "help-gtk", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_NONE, &show_help_gtk, N_("Show help options"), NULL },
++#if 0
+ { G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_FILENAME_ARRAY, &start_panels, N_("Panel to display"), NULL },
++#endif
+ { NULL } /* end the list */
+ };
+
+@@ -71,13 +77,17 @@ application_command_line_cb (GApplication *application,
+ GError *error = NULL;
+
+ verbose = FALSE;
++#if 0
+ show_overview = FALSE;
++#endif
+ show_help = FALSE;
++#if 0
+ start_panels = NULL;
++#endif
+
+ argv = g_application_command_line_get_arguments (command_line, &argc);
+
+- context = g_option_context_new (N_("- System Settings"));
++ context = g_option_context_new (N_("- Administrator Settings"));
+ g_option_context_add_main_entries (context, all_options, GETTEXT_PACKAGE);
+ g_option_context_set_translation_domain(context, GETTEXT_PACKAGE);
+ g_option_context_add_group (context, gtk_get_option_group (TRUE));
+@@ -115,6 +125,7 @@ application_command_line_cb (GApplication *application,
+
+ gnome_control_center_show (shell, GTK_APPLICATION (application));
+
++#if 0
+ if (show_overview)
+ {
+ gnome_control_center_set_overview_page (shell);
+@@ -138,17 +149,20 @@ application_command_line_cb (GApplication *application,
+ }
+ }
+ }
++#endif
+
+ gnome_control_center_present (shell);
+ gdk_notify_startup_complete ();
+
+ g_strfreev (argv);
++#if 0
+ if (start_panels != NULL)
+ {
+ g_strfreev (start_panels);
+ start_panels = NULL;
+ }
+ show_overview = FALSE;
++#endif
+
+ return retval;
+ }
+@@ -169,6 +183,8 @@ main (int argc, char **argv)
+ GtkApplication *application;
+ int status;
+
++ bindtextdomain (YAST_CC_PACKAGE, YASTLOCALEDIR);
++ bind_textdomain_codeset (YAST_CC_PACKAGE, "UTF-8");
+ bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
+ bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+ textdomain (GETTEXT_PACKAGE);
+@@ -178,13 +194,17 @@ main (int argc, char **argv)
+ gtk_init (&argc, &argv);
+ cc_shell_log_init ();
+
++ GtkIconTheme * theme;
++ theme = gtk_icon_theme_get_default();
++ gtk_icon_theme_prepend_search_path (theme, "/usr/share/YaST2/theme/current");
++
+ /* register a symbolic icon size for use in sidebar lists */
+ gtk_icon_size_register ("cc-sidebar-list", 24, 24);
+
+ shell = gnome_control_center_new ();
+
+ /* enforce single instance of this application */
+- application = gtk_application_new ("org.gnome.ControlCenter", G_APPLICATION_HANDLES_COMMAND_LINE);
++ application = gtk_application_new ("org.opensuse.yast-control-center-gnome", G_APPLICATION_HANDLES_COMMAND_LINE);
+ g_signal_connect (application, "startup",
+ G_CALLBACK (application_startup_cb), shell);
+ g_signal_connect (application, "command-line",
+diff --git a/shell/gnome-control-center.c b/shell/gnome-control-center.c
+index a771282..652300b 100644
+--- a/shell/gnome-control-center.c
++++ b/shell/gnome-control-center.c
+@@ -31,8 +31,8 @@
+ #define GMENU_I_KNOW_THIS_IS_UNSTABLE
+ #include <gmenu-tree.h>
+
+-#include "cc-panel.h"
+-#include "cc-shell.h"
++#include <libgnome-control-center/cc-panel.h>
++#include <libgnome-control-center/cc-shell.h>
+ #include "shell-search-renderer.h"
+ #include "cc-shell-category-view.h"
+ #include "cc-shell-model.h"
+@@ -91,6 +91,33 @@ activate_panel (GnomeControlCenter *shell,
+ const gchar *name,
+ const gchar *icon_name)
+ {
++ GDesktopAppInfo *appinfo;
++ GdkAppLaunchContext *context;
++ GdkScreen *screen;
++ GdkDisplay *display;
++ GError *error;
++
++ appinfo = g_desktop_app_info_new_from_filename (desktop_file);
++
++ screen = gtk_widget_get_screen (shell->priv->window);
++ display = gdk_screen_get_display (screen);
++ context = gdk_display_get_app_launch_context (display);
++ gdk_app_launch_context_set_screen (context, screen);
++ gdk_app_launch_context_set_timestamp (context, gtk_get_current_event_time ());
++
++ error = NULL;
++ g_app_info_launch_uris (G_APP_INFO (appinfo), NULL,
++ (GAppLaunchContext *) context,
++ &error);
++
++ if (error) {
++ g_printerr ("Could not launch '%s': %s\n", id, error->message);
++ g_clear_error (&error);
++ }
++
++ g_object_unref (context);
++ g_object_unref (appinfo);
++#if 0
+ GnomeControlCenterPrivate *priv = shell->priv;
+ GType panel_type = G_TYPE_INVALID;
+ GList *panels, *l;
+@@ -170,6 +197,7 @@ activate_panel (GnomeControlCenter *shell,
+ g_warning ("Could not find the loadable module for panel '%s'", id);
+ }
+ }
++#endif
+ }
+
+ static void
+@@ -685,7 +713,7 @@ setup_model (GnomeControlCenter *shell)
+
+ priv->store = (GtkListStore *) cc_shell_model_new ();
+ priv->category_views = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+- priv->menu_tree = gmenu_tree_lookup (MENUDIR "/gnomecc.menu", 0);
++ priv->menu_tree = gmenu_tree_lookup ("YaST-gnome.menu", 0);
+
+ if (priv->menu_tree == NULL)
+ {
+@@ -701,6 +729,7 @@ setup_model (GnomeControlCenter *shell)
+ static void
+ load_panel_plugins (GnomeControlCenter *shell)
+ {
++#if 0
+ GList *modules;
+
+ /* only allow this function to be run once to prevent modules being loaded
+@@ -719,6 +748,7 @@ load_panel_plugins (GnomeControlCenter *shell)
+ modules = g_io_modules_load_all_in_directory (PANELS_DIR);
+ g_list_free (modules);
+
++#endif
+ }
+
+
+@@ -978,7 +1008,16 @@ on_window_size_allocate (GtkWidget *widget,
+ screen = gtk_widget_get_screen (widget);
+ monitor = gdk_screen_get_monitor_at_window (screen, window);
+ gdk_screen_get_monitor_geometry (screen, monitor, &rect);
+- height = MIN (height + 10, rect.height - 120);
++ height = (rect.height * 3) / 5;
++ } else {
++ int monitor;
++ GdkScreen *screen;
++ GdkRectangle rect;
++
++ screen = gdk_screen_get_default ();
++ monitor = gdk_screen_get_primary_monitor (screen);
++ gdk_screen_get_monitor_geometry (screen, monitor, &rect);
++ height = (rect.height * 3) / 5;
+ }
+ }
+ else
+diff --git a/shell/shell.ui b/shell/shell.ui
+index e63f19f..f8e0d7e 100644
+--- a/shell/shell.ui
++++ b/shell/shell.ui
+@@ -3,9 +3,9 @@
+ <requires lib="gtk+" version="2.16"/>
+ <!-- interface-naming-policy project-wide -->
+ <object class="GtkWindow" id="main-window">
+- <property name="title" translatable="yes">System Settings</property>
+- <property name="resizable">False</property>
+- <property name="icon_name">preferences-desktop</property>
++ <property name="title" translatable="yes">Administrator Settings</property>
++ <property name="resizable">True</property>
++ <property name="icon_name">yast</property>
+ <property name="window_position">center</property>
+ <child>
+ <object class="GtkVBox" id="vbox1">
Modified: trunk/control-center-gnome/src/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/trunk/control-center-gnome/src/Makefil…
==============================================================================
--- trunk/control-center-gnome/src/Makefile.am (original)
+++ trunk/control-center-gnome/src/Makefile.am Mon Jul 25 12:21:36 2011
@@ -1,11 +1,44 @@
INCLUDES = $(CONTROL_CFLAGS)
AM_CPPFLAGS = \
- -DYASTLOCALEDIR="\"$(datadir)/YaST2/locale\"" \
+ -DGETTEXT_PACKAGE="\"gnome-control-center-2.0\"" \
-DGNOMELOCALEDIR="\"$(datadir)/locale\"" \
- -DENABLE_NLS=1
+ -DYAST_CC_PACKAGE="\"control-center\"" \
+ -DYASTLOCALEDIR="\"$(datadir)/YaST2/locale\"" \
+ -DUIDIR="\"$(uidir)\""
ybin_PROGRAMS = y2controlcenter-gnome
-y2controlcenter_gnome_SOURCES = control-center.c
+MARSHAL_FILES = cc-shell-marshal.c cc-shell-marshal.h
+BUILT_SOURCES = $(MARSHAL_FILES)
+
+cc-shell-marshal.h: cc-shell-marshal.list
+ $(AM_V_GEN) $(GLIB_GENMARSHAL) --prefix=cc_shell_marshal $< --header > $@
+
+cc-shell-marshal.c: cc-shell-marshal.list
+ $(AM_V_GEN) $(GLIB_GENMARSHAL) --prefix=cc_shell_marshal $< --body --header > $@
+
+y2controlcenter_gnome_SOURCES = \
+ control-center.c \
+ cc-shell-log.c \
+ cc-shell-log.h \
+ gnome-control-center.c \
+ gnome-control-center.h \
+ shell-search-renderer.c \
+ shell-search-renderer.h \
+ cc-shell-category-view.c \
+ cc-shell-category-view.h \
+ cc-shell-item-view.c \
+ cc-shell-item-view.h \
+ cc-shell-model.c \
+ cc-shell-model.h \
+ $(MARSHAL_FILES)
+
y2controlcenter_gnome_LDADD = $(CONTROL_LIBS)
+
+uidir = $(pkgdatadir)/ui
+ui_DATA = shell.ui
+
+EXTRA_DIST = \
+ $(ui_DATA) \
+ cc-shell-marshal.list
Added: trunk/control-center-gnome/src/cc-shell-category-view.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/control-center-gnome/src/cc-shel…
==============================================================================
--- trunk/control-center-gnome/src/cc-shell-category-view.c (added)
+++ trunk/control-center-gnome/src/cc-shell-category-view.c Mon Jul 25 12:21:36 2011
@@ -0,0 +1,261 @@
+/*
+ * Copyright (c) 2010 Intel, Inc.
+ *
+ * The Control Center is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * The Control Center is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with the Control Center; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author: Thomas Wood <thos(a)gnome.org>
+ */
+
+#include "cc-shell-category-view.h"
+#include "cc-shell-item-view.h"
+#include <libgnome-control-center/cc-shell.h>
+#include "cc-shell-model.h"
+
+G_DEFINE_TYPE (CcShellCategoryView, cc_shell_category_view, GTK_TYPE_FRAME)
+
+#define SHELL_CATEGORY_VIEW_PRIVATE(o) \
+ (G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_SHELL_CATEGORY_VIEW, CcShellCategoryViewPrivate))
+
+enum
+{
+ PROP_NAME = 1,
+ PROP_MODEL
+};
+
+struct _CcShellCategoryViewPrivate
+{
+ gchar *name;
+ GtkTreeModel *model;
+ GtkWidget *iconview;
+};
+
+static void
+cc_shell_category_view_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ CcShellCategoryViewPrivate *priv = CC_SHELL_CATEGORY_VIEW (object)->priv;
+
+ switch (property_id)
+ {
+ case PROP_NAME:
+ g_value_set_string (value, priv->name);
+ break;
+
+ case PROP_MODEL:
+ g_value_set_object (value, priv->model);
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ }
+}
+
+static void
+cc_shell_category_view_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ CcShellCategoryViewPrivate *priv = CC_SHELL_CATEGORY_VIEW (object)->priv;
+
+ switch (property_id)
+ {
+ case PROP_NAME:
+ priv->name = g_value_dup_string (value);
+ break;
+
+ case PROP_MODEL:
+ priv->model = g_value_dup_object (value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ }
+}
+
+static void
+cc_shell_category_view_dispose (GObject *object)
+{
+ CcShellCategoryViewPrivate *priv = CC_SHELL_CATEGORY_VIEW (object)->priv;
+
+ if (priv->model)
+ {
+ g_object_unref (priv->model);
+ priv->model = NULL;
+ }
+
+ G_OBJECT_CLASS (cc_shell_category_view_parent_class)->dispose (object);
+}
+
+static void
+cc_shell_category_view_finalize (GObject *object)
+{
+ CcShellCategoryViewPrivate *priv = CC_SHELL_CATEGORY_VIEW (object)->priv;
+
+ if (priv->name)
+ {
+ g_free (priv->name);
+ priv->name = NULL;
+ }
+
+ G_OBJECT_CLASS (cc_shell_category_view_parent_class)->finalize (object);
+}
+
+static void
+label_style_set_cb (GtkWidget *widget,
+ GtkStyle *old_style,
+ gpointer user_data)
+{
+ GtkStyle *style;
+
+ /* "base" colours are used for the background inside CcShellCategoryView,
+ * so set the labels to use the "text" colors */
+
+ g_signal_handlers_block_by_func (widget, label_style_set_cb, NULL);
+
+ style = gtk_widget_get_style (widget);
+
+ gtk_widget_modify_fg (widget, GTK_STATE_NORMAL,
+ &style->text[GTK_STATE_NORMAL]);
+
+ g_signal_handlers_unblock_by_func (widget, label_style_set_cb, NULL);
+}
+
+
+
+static void
+cc_shell_category_view_constructed (GObject *object)
+{
+ CcShellCategoryViewPrivate *priv = CC_SHELL_CATEGORY_VIEW (object)->priv;
+ GtkWidget *iconview, *vbox;
+
+ iconview = cc_shell_item_view_new ();
+ gtk_icon_view_set_model (GTK_ICON_VIEW (iconview), priv->model);
+
+ vbox = gtk_vbox_new (FALSE, 0);
+
+ gtk_icon_view_set_pixbuf_column (GTK_ICON_VIEW (iconview), COL_PIXBUF);
+ gtk_icon_view_set_text_column (GTK_ICON_VIEW (iconview), COL_NAME);
+ gtk_icon_view_set_item_width (GTK_ICON_VIEW (iconview), 100);
+ cc_shell_item_view_update_cells (CC_SHELL_ITEM_VIEW (iconview));
+
+ /* create the header if required */
+ if (priv->name)
+ {
+ GtkWidget *label;
+ PangoAttrList *attrs;
+
+ label = gtk_label_new (priv->name);
+ attrs = pango_attr_list_new ();
+ pango_attr_list_insert (attrs, pango_attr_weight_new (PANGO_WEIGHT_BOLD));
+ gtk_label_set_attributes (GTK_LABEL (label), attrs);
+ pango_attr_list_unref (attrs);
+ gtk_frame_set_label_widget (GTK_FRAME (object), label);
+
+ g_signal_connect (label, "style-set", G_CALLBACK (label_style_set_cb),
+ NULL);
+ }
+
+ /* add the iconview to the vbox */
+ gtk_box_pack_start (GTK_BOX (vbox), iconview, FALSE, TRUE, 0);
+
+ /* add the main vbox to the view */
+ gtk_container_add (GTK_CONTAINER (object), vbox);
+ gtk_widget_show_all (vbox);
+
+ priv->iconview = iconview;
+}
+
+static gboolean
+cc_shell_category_view_draw (GtkWidget *widget,
+ cairo_t *cr)
+{
+ GtkStyle *style;
+ GtkStateType state;
+ GtkAllocation allocation;
+
+ style = gtk_widget_get_style (widget);
+ state = gtk_widget_get_state (widget);
+ gtk_widget_get_allocation (widget, &allocation);
+
+
+ cairo_rectangle (cr, 0, 0, allocation.width, allocation.height);
+ gdk_cairo_set_source_color (cr, &style->base[state]);
+
+ cairo_fill (cr);
+
+ GTK_WIDGET_CLASS (cc_shell_category_view_parent_class)->draw (widget, cr);
+
+ return FALSE;
+}
+
+static void
+cc_shell_category_view_class_init (CcShellCategoryViewClass *klass)
+{
+ GParamSpec *pspec;
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+ g_type_class_add_private (klass, sizeof (CcShellCategoryViewPrivate));
+
+ object_class->get_property = cc_shell_category_view_get_property;
+ object_class->set_property = cc_shell_category_view_set_property;
+ object_class->dispose = cc_shell_category_view_dispose;
+ object_class->finalize = cc_shell_category_view_finalize;
+ object_class->constructed = cc_shell_category_view_constructed;
+
+ widget_class->draw = cc_shell_category_view_draw;
+
+ pspec = g_param_spec_string ("name",
+ "Name",
+ "Name of the category",
+ NULL,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY
+ | G_PARAM_STATIC_STRINGS);
+ g_object_class_install_property (object_class, PROP_NAME, pspec);
+
+ pspec = g_param_spec_object ("model",
+ "Model",
+ "Model of the category",
+ GTK_TYPE_TREE_MODEL,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY
+ | G_PARAM_STATIC_STRINGS);
+ g_object_class_install_property (object_class, PROP_MODEL, pspec);
+
+}
+
+static void
+cc_shell_category_view_init (CcShellCategoryView *self)
+{
+ self->priv = SHELL_CATEGORY_VIEW_PRIVATE (self);
+
+ gtk_frame_set_shadow_type (GTK_FRAME (self), GTK_SHADOW_NONE);
+}
+
+GtkWidget *
+cc_shell_category_view_new (const gchar *name,
+ GtkTreeModel *model)
+{
+ return g_object_new (CC_TYPE_SHELL_CATEGORY_VIEW,
+ "name", name,
+ "model", model, NULL);
+}
+
+CcShellItemView*
+cc_shell_category_view_get_item_view (CcShellCategoryView *self)
+{
+ return (CcShellItemView*) self->priv->iconview;
+}
Added: trunk/control-center-gnome/src/cc-shell-category-view.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/control-center-gnome/src/cc-shel…
==============================================================================
--- trunk/control-center-gnome/src/cc-shell-category-view.h (added)
+++ trunk/control-center-gnome/src/cc-shell-category-view.h Mon Jul 25 12:21:36 2011
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2010 Intel, Inc.
+ *
+ * The Control Center is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * The Control Center is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with the Control Center; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author: Thomas Wood <thos(a)gnome.org>
+ */
+
+
+#ifndef _CC_SHELL_CATEGORY_VIEW_H
+#define _CC_SHELL_CATEGORY_VIEW_H
+
+#include <gtk/gtk.h>
+#include "cc-shell-item-view.h"
+
+G_BEGIN_DECLS
+
+#define CC_TYPE_SHELL_CATEGORY_VIEW cc_shell_category_view_get_type()
+
+#define CC_SHELL_CATEGORY_VIEW(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ CC_TYPE_SHELL_CATEGORY_VIEW, CcShellCategoryView))
+
+#define CC_SHELL_CATEGORY_VIEW_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST ((klass), \
+ CC_TYPE_SHELL_CATEGORY_VIEW, CcShellCategoryViewClass))
+
+#define CC_IS_SHELL_CATEGORY_VIEW(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+ CC_TYPE_SHELL_CATEGORY_VIEW))
+
+#define CC_IS_SHELL_CATEGORY_VIEW_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+ CC_TYPE_SHELL_CATEGORY_VIEW))
+
+#define CC_SHELL_CATEGORY_VIEW_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ CC_TYPE_SHELL_CATEGORY_VIEW, CcShellCategoryViewClass))
+
+typedef struct _CcShellCategoryView CcShellCategoryView;
+typedef struct _CcShellCategoryViewClass CcShellCategoryViewClass;
+typedef struct _CcShellCategoryViewPrivate CcShellCategoryViewPrivate;
+
+struct _CcShellCategoryView
+{
+ GtkFrame parent;
+
+ CcShellCategoryViewPrivate *priv;
+};
+
+struct _CcShellCategoryViewClass
+{
+ GtkFrameClass parent_class;
+};
+
+GType cc_shell_category_view_get_type (void) G_GNUC_CONST;
+
+GtkWidget *cc_shell_category_view_new (const gchar *name,
+ GtkTreeModel *model);
+CcShellItemView* cc_shell_category_view_get_item_view (CcShellCategoryView *self);
+
+G_END_DECLS
+
+#endif /* _CC_SHELL_CATEGORY_VIEW_H */
Added: trunk/control-center-gnome/src/cc-shell-item-view.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/control-center-gnome/src/cc-shel…
==============================================================================
--- trunk/control-center-gnome/src/cc-shell-item-view.c (added)
+++ trunk/control-center-gnome/src/cc-shell-item-view.c Mon Jul 25 12:21:36 2011
@@ -0,0 +1,215 @@
+/*
+ * Copyright (c) 2010 Intel, Inc.
+ *
+ * The Control Center is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * The Control Center is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with the Control Center; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author: Thomas Wood <thos(a)gnome.org>
+ */
+
+#include "cc-shell-item-view.h"
+#include "cc-shell-model.h"
+#include "cc-shell-marshal.h"
+
+G_DEFINE_TYPE (CcShellItemView, cc_shell_item_view, GTK_TYPE_ICON_VIEW)
+
+#define SHELL_ITEM_VIEW_PRIVATE(o) \
+ (G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_SHELL_ITEM_VIEW, CcShellItemViewPrivate))
+
+struct _CcShellItemViewPrivate
+{
+ gboolean ignore_release;
+};
+
+
+enum
+{
+ DESKTOP_ITEM_ACTIVATED,
+
+ LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL] = {0,};
+
+static void
+cc_shell_item_view_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id)
+ {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ }
+}
+
+static void
+cc_shell_item_view_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id)
+ {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ }
+}
+
+static void
+cc_shell_item_view_dispose (GObject *object)
+{
+ G_OBJECT_CLASS (cc_shell_item_view_parent_class)->dispose (object);
+}
+
+static void
+cc_shell_item_view_finalize (GObject *object)
+{
+ G_OBJECT_CLASS (cc_shell_item_view_parent_class)->finalize (object);
+}
+
+static gboolean
+iconview_button_press_event_cb (GtkWidget *widget,
+ GdkEventButton *event,
+ CcShellItemView *cc_view)
+{
+ /* be sure to ignore double and triple clicks */
+ cc_view->priv->ignore_release = (event->type != GDK_BUTTON_PRESS);
+
+ return FALSE;
+}
+
+static gboolean
+iconview_button_release_event_cb (GtkWidget *widget,
+ GdkEventButton *event,
+ CcShellItemView *cc_view)
+{
+ CcShellItemViewPrivate *priv = cc_view->priv;
+
+ if (event->button == 1 && !priv->ignore_release)
+ {
+ GList *selection;
+
+ selection =
+ gtk_icon_view_get_selected_items (GTK_ICON_VIEW (cc_view));
+
+ if (!selection)
+ return TRUE;
+
+ gtk_icon_view_item_activated (GTK_ICON_VIEW (cc_view),
+ (GtkTreePath*) selection->data);
+
+ g_list_free (selection);
+ }
+
+ return TRUE;
+}
+
+static void
+iconview_item_activated_cb (GtkIconView *icon_view,
+ GtkTreePath *path,
+ CcShellItemView *cc_view)
+{
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ gchar *name, *desktop_file, *id;
+
+ model = gtk_icon_view_get_model (icon_view);
+
+ gtk_icon_view_unselect_all (icon_view);
+
+ /* get the iter and ensure it is valid */
+ if (!gtk_tree_model_get_iter (model, &iter, path))
+ return;
+
+ gtk_tree_model_get (model, &iter,
+ COL_NAME, &name,
+ COL_DESKTOP_FILE, &desktop_file,
+ COL_ID, &id,
+ -1);
+
+ g_signal_emit (cc_view, signals[DESKTOP_ITEM_ACTIVATED], 0,
+ name, id, desktop_file);
+
+ g_free (desktop_file);
+ g_free (name);
+ g_free (id);
+}
+
+void
+cc_shell_item_view_update_cells (CcShellItemView *view)
+{
+ GList *cells, *l;
+
+ cells = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (view));
+ for (l = cells ; l != NULL; l = l->next)
+ {
+ GtkCellRenderer *cell = l->data;
+
+ if (GTK_IS_CELL_RENDERER_TEXT (cell)) {
+ g_object_set (G_OBJECT (cell),
+ "wrap-mode", PANGO_WRAP_WORD,
+ NULL);
+ /* We only have one text cell */
+ break;
+ }
+ }
+}
+
+static void
+cc_shell_item_view_class_init (CcShellItemViewClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ g_type_class_add_private (klass, sizeof (CcShellItemViewPrivate));
+
+ object_class->get_property = cc_shell_item_view_get_property;
+ object_class->set_property = cc_shell_item_view_set_property;
+ object_class->dispose = cc_shell_item_view_dispose;
+ object_class->finalize = cc_shell_item_view_finalize;
+
+ signals[DESKTOP_ITEM_ACTIVATED] = g_signal_new ("desktop-item-activated",
+ CC_TYPE_SHELL_ITEM_VIEW,
+ G_SIGNAL_RUN_FIRST,
+ 0,
+ NULL,
+ NULL,
+ cc_shell_marshal_VOID__STRING_STRING_STRING,
+ G_TYPE_NONE,
+ 3,
+ G_TYPE_STRING,
+ G_TYPE_STRING,
+ G_TYPE_STRING);
+}
+
+static void
+cc_shell_item_view_init (CcShellItemView *self)
+{
+ self->priv = SHELL_ITEM_VIEW_PRIVATE (self);
+
+ g_object_set (self, "margin", 0, NULL);
+ g_signal_connect (self, "item-activated",
+ G_CALLBACK (iconview_item_activated_cb), self);
+ g_signal_connect (self, "button-press-event",
+ G_CALLBACK (iconview_button_press_event_cb), self);
+ g_signal_connect (self, "button-release-event",
+ G_CALLBACK (iconview_button_release_event_cb), self);
+}
+
+GtkWidget *
+cc_shell_item_view_new (void)
+{
+ return g_object_new (CC_TYPE_SHELL_ITEM_VIEW, NULL);
+}
Added: trunk/control-center-gnome/src/cc-shell-item-view.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/control-center-gnome/src/cc-shel…
==============================================================================
--- trunk/control-center-gnome/src/cc-shell-item-view.h (added)
+++ trunk/control-center-gnome/src/cc-shell-item-view.h Mon Jul 25 12:21:36 2011
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2010 Intel, Inc.
+ *
+ * The Control Center is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * The Control Center is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with the Control Center; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author: Thomas Wood <thos(a)gnome.org>
+ */
+
+#ifndef _CC_SHELL_ITEM_VIEW_H
+#define _CC_SHELL_ITEM_VIEW_H
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define CC_TYPE_SHELL_ITEM_VIEW cc_shell_item_view_get_type()
+
+#define CC_SHELL_ITEM_VIEW(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ CC_TYPE_SHELL_ITEM_VIEW, CcShellItemView))
+
+#define CC_SHELL_ITEM_VIEW_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST ((klass), \
+ CC_TYPE_SHELL_ITEM_VIEW, CcShellItemViewClass))
+
+#define CC_IS_SHELL_ITEM_VIEW(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+ CC_TYPE_SHELL_ITEM_VIEW))
+
+#define CC_IS_SHELL_ITEM_VIEW_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+ CC_TYPE_SHELL_ITEM_VIEW))
+
+#define CC_SHELL_ITEM_VIEW_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ CC_TYPE_SHELL_ITEM_VIEW, CcShellItemViewClass))
+
+typedef struct _CcShellItemView CcShellItemView;
+typedef struct _CcShellItemViewClass CcShellItemViewClass;
+typedef struct _CcShellItemViewPrivate CcShellItemViewPrivate;
+
+struct _CcShellItemView
+{
+ GtkIconView parent;
+
+ CcShellItemViewPrivate *priv;
+};
+
+struct _CcShellItemViewClass
+{
+ GtkIconViewClass parent_class;
+};
+
+GType cc_shell_item_view_get_type (void) G_GNUC_CONST;
+
+GtkWidget *cc_shell_item_view_new (void);
+
+void cc_shell_item_view_update_cells (CcShellItemView *view);
+
+G_END_DECLS
+
+#endif /* _CC_SHELL_ITEM_VIEW_H */
Added: trunk/control-center-gnome/src/cc-shell-log.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/control-center-gnome/src/cc-shel…
==============================================================================
--- trunk/control-center-gnome/src/cc-shell-log.c (added)
+++ trunk/control-center-gnome/src/cc-shell-log.c Mon Jul 25 12:21:36 2011
@@ -0,0 +1,63 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2009 Red Hat, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ */
+
+
+#include "config.h"
+
+#include <glib.h>
+#include <glib/gstdio.h>
+
+#include "cc-shell-log.h"
+
+static int log_levels = G_LOG_LEVEL_CRITICAL |
+ G_LOG_LEVEL_ERROR |
+ G_LOG_LEVEL_WARNING |
+ G_LOG_LEVEL_MESSAGE |
+ G_LOG_LEVEL_INFO |
+ G_LOG_LEVEL_DEBUG;
+
+static void
+cc_shell_log_default_handler (const gchar *log_domain,
+ GLogLevelFlags log_level,
+ const gchar *message,
+ gpointer unused_data)
+{
+ if ((log_level & log_levels) == 0)
+ return;
+
+ g_log_default_handler (log_domain, log_level, message, unused_data);
+}
+
+void
+cc_shell_log_init (void)
+{
+ g_log_set_default_handler (cc_shell_log_default_handler, NULL);
+}
+
+void
+cc_shell_log_set_debug (gboolean debug)
+{
+ if (debug) {
+ log_levels |= (G_LOG_LEVEL_DEBUG | G_LOG_LEVEL_INFO);
+ g_debug ("Enabling debugging");
+ } else {
+ log_levels &= ~ (G_LOG_LEVEL_DEBUG | G_LOG_LEVEL_INFO);
+ }
+}
Added: trunk/control-center-gnome/src/cc-shell-log.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/control-center-gnome/src/cc-shel…
==============================================================================
--- trunk/control-center-gnome/src/cc-shell-log.h (added)
+++ trunk/control-center-gnome/src/cc-shell-log.h Mon Jul 25 12:21:36 2011
@@ -0,0 +1,33 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2009 Red Hat, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ */
+
+#ifndef __CC_SHELL_LOG_H
+#define __CC_SHELL_LOG_H
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+void cc_shell_log_init (void);
+void cc_shell_log_set_debug (gboolean debug);
+
+G_END_DECLS
+
+#endif /* __CC_SHELL_LOG_H */
Added: trunk/control-center-gnome/src/cc-shell-marshal.list
URL: http://svn.opensuse.org/viewcvs/yast/trunk/control-center-gnome/src/cc-shel…
==============================================================================
--- trunk/control-center-gnome/src/cc-shell-marshal.list (added)
+++ trunk/control-center-gnome/src/cc-shell-marshal.list Mon Jul 25 12:21:36 2011
@@ -0,0 +1 @@
+VOID:STRING,STRING,STRING
Added: trunk/control-center-gnome/src/cc-shell-model.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/control-center-gnome/src/cc-shel…
==============================================================================
--- trunk/control-center-gnome/src/cc-shell-model.c (added)
+++ trunk/control-center-gnome/src/cc-shell-model.c Mon Jul 25 12:21:36 2011
@@ -0,0 +1,223 @@
+/*
+ * Copyright (c) 2009, 2010 Intel, Inc.
+ * Copyright (c) 2010 Red Hat, Inc.
+ *
+ * The Control Center is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * The Control Center is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with the Control Center; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author: Thomas Wood <thos(a)gnome.org>
+ */
+
+#include "cc-shell-model.h"
+#include <string.h>
+
+#define GNOME_SETTINGS_PANEL_ID_KEY "X-GNOME-Settings-Panel"
+#define GNOME_SETTINGS_PANEL_CATEGORY GNOME_SETTINGS_PANEL_ID_KEY
+#define GNOME_SETTINGS_PANEL_ID_KEYWORDS "X-GNOME-Keywords"
+
+
+G_DEFINE_TYPE (CcShellModel, cc_shell_model, GTK_TYPE_LIST_STORE)
+
+static GdkPixbuf *
+load_pixbuf_for_string (const char *icon)
+{
+ GtkIconTheme *theme;
+ GdkPixbuf *pixbuf;
+ GError *err = NULL;
+ char *icon2 = NULL;
+
+ if (icon == NULL)
+ return NULL;
+
+ theme = gtk_icon_theme_get_default ();
+
+ /* find the icon */
+ if (*icon == '/')
+ {
+ pixbuf = gdk_pixbuf_new_from_file_at_scale (icon, 32, 32, TRUE, &err);
+ }
+ else
+ {
+ if (g_str_has_suffix (icon, ".png"))
+ icon2 = g_strndup (icon, strlen (icon) - strlen (".png"));
+
+ pixbuf = gtk_icon_theme_load_icon (theme,
+ icon2 ? icon2 : icon, 32,
+ GTK_ICON_LOOKUP_FORCE_SIZE,
+ &err);
+ }
+
+ if (err)
+ {
+ g_warning ("Could not load icon '%s': %s", icon2 ? icon2 : icon,
+ err->message);
+ g_error_free (err);
+ }
+
+ g_free (icon2);
+
+ return pixbuf;
+}
+
+static void
+icon_theme_changed (GtkIconTheme *theme,
+ CcShellModel *self)
+{
+ GtkTreeIter iter;
+ GtkTreeModel *model;
+ gboolean cont;
+
+ model = GTK_TREE_MODEL (self);
+ cont = gtk_tree_model_get_iter_first (model, &iter);
+ while (cont)
+ {
+ GdkPixbuf *pixbuf;
+ char *icon;
+
+ gtk_tree_model_get (model, &iter,
+ COL_ICON_NAME, &icon,
+ -1);
+ pixbuf = load_pixbuf_for_string (icon);
+ g_free (icon);
+ gtk_list_store_set (GTK_LIST_STORE (model), &iter,
+ COL_PIXBUF, pixbuf,
+ -1);
+
+ cont = gtk_tree_model_iter_next (model, &iter);
+ }
+}
+
+static void
+cc_shell_model_class_init (CcShellModelClass *klass)
+{
+}
+
+static void
+cc_shell_model_init (CcShellModel *self)
+{
+ GType types[] = {G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
+ GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRV};
+
+ gtk_list_store_set_column_types (GTK_LIST_STORE (self),
+ N_COLS, types);
+
+ gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (self), COL_NAME,
+ GTK_SORT_ASCENDING);
+
+ g_signal_connect (G_OBJECT (gtk_icon_theme_get_default ()), "changed",
+ G_CALLBACK (icon_theme_changed), self);
+}
+
+CcShellModel *
+cc_shell_model_new (void)
+{
+ return g_object_new (CC_TYPE_SHELL_MODEL, NULL);
+}
+
+static gboolean
+desktop_entry_has_panel_category (GKeyFile *key_file)
+{
+ char **strv;
+ gsize len;
+ int i;
+
+ strv = g_key_file_get_string_list (key_file,
+ "Desktop Entry",
+ "Categories",
+ &len,
+ NULL);
+ if (!strv)
+ return FALSE;
+
+ for (i = 0; strv[i]; i++)
+ {
+ if (g_str_equal (strv[i], GNOME_SETTINGS_PANEL_CATEGORY))
+ {
+ g_strfreev (strv);
+ return TRUE;
+ }
+ }
+
+ g_strfreev (strv);
+
+ return FALSE;
+
+}
+
+void
+cc_shell_model_add_item (CcShellModel *model,
+ const gchar *category_name,
+ GMenuTreeEntry *item)
+{
+ const gchar *icon = gmenu_tree_entry_get_icon (item);
+ const gchar *name = gmenu_tree_entry_get_name (item);
+ const gchar *desktop = gmenu_tree_entry_get_desktop_file_path (item);
+ const gchar *comment = gmenu_tree_entry_get_comment (item);
+ gchar *id;
+ GdkPixbuf *pixbuf = NULL;
+ gchar *search_target;
+ GKeyFile *key_file;
+ gchar **keywords;
+
+ /* load the .desktop file since gnome-menus doesn't have a way to read
+ * custom properties from desktop files */
+
+ key_file = g_key_file_new ();
+ g_key_file_load_from_file (key_file, desktop, 0, NULL);
+
+ id = g_key_file_get_string (key_file, "Desktop Entry",
+ GNOME_SETTINGS_PANEL_ID_KEY, NULL);
+
+ if (!id)
+ {
+ /* Refuse to load desktop files without a panel ID, but
+ * with the X-GNOME-Settings-Panel category */
+ if (desktop_entry_has_panel_category (key_file))
+ {
+ g_warning ("Not loading desktop file '%s' because it uses the "
+ GNOME_SETTINGS_PANEL_CATEGORY
+ " category but isn't a panel.",
+ desktop);
+ g_key_file_free (key_file);
+ return;
+ }
+ id = g_strdup (gmenu_tree_entry_get_desktop_file_id (item));
+ }
+
+ keywords = g_key_file_get_locale_string_list (key_file, "Desktop Entry",
+ GNOME_SETTINGS_PANEL_ID_KEYWORDS,
+ NULL, NULL, NULL);
+
+ g_key_file_free (key_file);
+ key_file = NULL;
+
+ pixbuf = load_pixbuf_for_string (icon);
+
+ search_target = g_strconcat (name, " - ", comment, NULL);
+
+ gtk_list_store_insert_with_values (GTK_LIST_STORE (model), NULL, 0,
+ COL_NAME, name,
+ COL_DESKTOP_FILE, desktop,
+ COL_ID, id,
+ COL_PIXBUF, pixbuf,
+ COL_CATEGORY, category_name,
+ COL_SEARCH_TARGET, search_target,
+ COL_ICON_NAME, icon,
+ COL_KEYWORDS, keywords,
+ -1);
+
+ g_free (id);
+ g_free (search_target);
+ g_strfreev (keywords);
+}
Added: trunk/control-center-gnome/src/cc-shell-model.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/control-center-gnome/src/cc-shel…
==============================================================================
--- trunk/control-center-gnome/src/cc-shell-model.h (added)
+++ trunk/control-center-gnome/src/cc-shell-model.h Mon Jul 25 12:21:36 2011
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2010 Intel, Inc.
+ *
+ * The Control Center is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * The Control Center is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with the Control Center; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author: Thomas Wood <thos(a)gnome.org>
+ */
+
+
+#ifndef _CC_SHELL_MODEL_H
+#define _CC_SHELL_MODEL_H
+
+#include <gtk/gtk.h>
+#define GMENU_I_KNOW_THIS_IS_UNSTABLE
+#include <gmenu-tree.h>
+
+G_BEGIN_DECLS
+
+#define CC_TYPE_SHELL_MODEL cc_shell_model_get_type()
+
+#define CC_SHELL_MODEL(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ CC_TYPE_SHELL_MODEL, CcShellModel))
+
+#define CC_SHELL_MODEL_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST ((klass), \
+ CC_TYPE_SHELL_MODEL, CcShellModelClass))
+
+#define CC_IS_SHELL_MODEL(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+ CC_TYPE_SHELL_MODEL))
+
+#define CC_IS_SHELL_MODEL_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+ CC_TYPE_SHELL_MODEL))
+
+#define CC_SHELL_MODEL_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ CC_TYPE_SHELL_MODEL, CcShellModelClass))
+
+typedef struct _CcShellModel CcShellModel;
+typedef struct _CcShellModelClass CcShellModelClass;
+
+enum
+{
+ COL_NAME,
+ COL_DESKTOP_FILE,
+ COL_ID,
+ COL_PIXBUF,
+ COL_CATEGORY,
+ COL_SEARCH_TARGET,
+ COL_ICON_NAME,
+ COL_KEYWORDS,
+
+ N_COLS
+};
+
+struct _CcShellModel
+{
+ GtkListStore parent;
+};
+
+struct _CcShellModelClass
+{
+ GtkListStoreClass parent_class;
+};
+
+GType cc_shell_model_get_type (void) G_GNUC_CONST;
+
+CcShellModel *cc_shell_model_new (void);
+
+void cc_shell_model_add_item (CcShellModel *model,
+ const gchar *category_name,
+ GMenuTreeEntry *item);
+
+G_END_DECLS
+
+#endif /* _CC_SHELL_MODEL_H */
Modified: trunk/control-center-gnome/src/control-center.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/control-center-gnome/src/control…
==============================================================================
--- trunk/control-center-gnome/src/control-center.c (original)
+++ trunk/control-center-gnome/src/control-center.c Mon Jul 25 12:21:36 2011
@@ -1,211 +1,218 @@
/*
- * This file is part of the Control Center.
+ * Copyright (c) 2009, 2010 Intel, Inc.
+ * Copyright (c) 2010 Red Hat, Inc.
*
- * Copyright (c) 2006 Novell, Inc.
+ * The Control Center is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
*
- * The Control Center is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option)
- * any later version.
+ * The Control Center is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
*
- * The Control Center is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
+ * You should have received a copy of the GNU General Public License along
+ * with the Control Center; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
- * You should have received a copy of the GNU General Public License along with
- * the Control Center; if not, write to the Free Software Foundation, Inc., 51
- * Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ * Author: Thomas Wood <thos(a)gnome.org>
*/
#include "config.h"
#include <glib/gi18n.h>
-#include <gtk/gtk.h>
-#include <libgnome/gnome-desktop-item.h>
-#include <unique/unique.h>
+#include <stdlib.h>
-#include <libslab/slab.h>
+#include "gnome-control-center.h"
-void handle_static_action_clicked (Tile * tile, TileEvent * event, gpointer data);
-static GSList *get_actions_list ();
+#include <gtk/gtk.h>
+#include <string.h>
-#define CONTROL_CENTER_PREFIX "/apps/yast-control-center/cc_"
-#define CONTROL_CENTER_ACTIONS_LIST_KEY (CONTROL_CENTER_PREFIX "actions_list")
-#define CONTROL_CENTER_ACTIONS_SEPARATOR ";"
-#define EXIT_SHELL_ON_STATIC_ACTION "exit_shell_on_static_action"
+#include "cc-shell-log.h"
-#define GETTEXT_PACKAGE "gnome-control-center-2.0"
-#define YAST_CC_PACKAGE "control-center"
+G_GNUC_NORETURN static gboolean
+option_version_cb (const gchar *option_name,
+ const gchar *value,
+ gpointer data,
+ GError **error)
+{
+ g_print ("%s %s\n", PACKAGE, VERSION);
+ exit (0);
+}
-static GSList *
-get_actions_list (void)
+#if 0
+static char **start_panels = NULL;
+static gboolean show_overview = FALSE;
+#endif
+static gboolean verbose = FALSE;
+static gboolean show_help = FALSE;
+static gboolean show_help_gtk = FALSE;
+static gboolean show_help_all = FALSE;
+
+const GOptionEntry all_options[] = {
+ { "version", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, option_version_cb, NULL, NULL },
+ { "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose, N_("Enable verbose mode"), NULL },
+#if 0
+ { "overview", 'o', 0, G_OPTION_ARG_NONE, &show_overview, N_("Show the overview"), NULL },
+#endif
+ { "help", 'h', G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_NONE, &show_help, N_("Show help options"), NULL },
+ { "help-all", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_NONE, &show_help_all, N_("Show help options"), NULL },
+ { "help-gtk", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_NONE, &show_help_gtk, N_("Show help options"), NULL },
+#if 0
+ { G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_FILENAME_ARRAY, &start_panels, N_("Panel to display"), NULL },
+#endif
+ { NULL } /* end the list */
+};
+
+static int
+application_command_line_cb (GApplication *application,
+ GApplicationCommandLine *command_line,
+ GnomeControlCenter *shell)
{
- GSList *l;
- GSList *key_list;
- GSList *actions_list = NULL;
- AppAction *action;
-
- key_list = get_slab_gconf_slist (CONTROL_CENTER_ACTIONS_LIST_KEY);
- if (!key_list)
- {
- g_warning (_("key not found [%s]\n"), CONTROL_CENTER_ACTIONS_LIST_KEY);
- return NULL;
- }
-
- for (l = key_list; l != NULL; l = l->next)
- {
- gchar *entry = (gchar *) l->data;
- gchar **temp;
-
- action = g_new (AppAction, 1);
- temp = g_strsplit (entry, CONTROL_CENTER_ACTIONS_SEPARATOR, 2);
- action->name = g_strdup (temp[0]);
- if ((action->item = load_desktop_item_from_unknown (temp[1])) == NULL)
- {
- g_warning ("get_actions_list() - PROBLEM - Can't load %s\n", temp[1]);
- }
- else
- {
- actions_list = g_slist_prepend (actions_list, action);
- }
- g_strfreev (temp);
- g_free (entry);
- }
+ int argc;
+ char **argv;
+ int retval = 0;
+ GOptionContext *context;
+ GError *error = NULL;
+
+ verbose = FALSE;
+#if 0
+ show_overview = FALSE;
+#endif
+ show_help = FALSE;
+#if 0
+ start_panels = NULL;
+#endif
+
+ argv = g_application_command_line_get_arguments (command_line, &argc);
+
+ context = g_option_context_new (N_("- Administrator Settings"));
+ g_option_context_add_main_entries (context, all_options, GETTEXT_PACKAGE);
+ g_option_context_set_translation_domain(context, GETTEXT_PACKAGE);
+ g_option_context_add_group (context, gtk_get_option_group (TRUE));
+ g_option_context_set_help_enabled (context, FALSE);
+
+ if (g_option_context_parse (context, &argc, &argv, &error) == FALSE)
+ {
+ g_print (_("%s\nRun '%s --help' to see a full list of available command line options.\n"),
+ error->message, argv[0]);
+ g_error_free (error);
+ g_option_context_free (context);
+ return 1;
+ }
+
+ if (show_help || show_help_all || show_help_gtk)
+ {
+ gchar *help;
+ GOptionGroup *group;
+
+ if (show_help || show_help_all)
+ group = NULL;
+ else
+ group = gtk_get_option_group (FALSE);
+
+ help = g_option_context_get_help (context, FALSE, group);
+ g_print ("%s", help);
+ g_free (help);
+ g_option_context_free (context);
+ return 0;
+ }
+
+ g_option_context_free (context);
+
+ cc_shell_log_set_debug (verbose);
+
+ gnome_control_center_show (shell, GTK_APPLICATION (application));
+
+#if 0
+ if (show_overview)
+ {
+ gnome_control_center_set_overview_page (shell);
+ }
+ else if (start_panels != NULL && start_panels[0] != NULL)
+ {
+ const char *start_id;
+ GError *err = NULL;
+
+ start_id = start_panels[0];
+
+ if (!cc_shell_set_active_panel_from_id (CC_SHELL (shell), start_id, &err))
+ {
+ g_warning ("Could not load setting panel \"%s\": %s", start_id,
+ (err) ? err->message : "Unknown error");
+ retval = 1;
+ if (err)
+ {
+ g_error_free (err);
+ err = NULL;
+ }
+ }
+ }
+#endif
+
+ gnome_control_center_present (shell);
+ gdk_notify_startup_complete ();
- g_slist_free (key_list);
+ g_strfreev (argv);
+#if 0
+ if (start_panels != NULL)
+ {
+ g_strfreev (start_panels);
+ start_panels = NULL;
+ }
+ show_overview = FALSE;
+#endif
- return g_slist_reverse (actions_list);
+ return retval;
}
-void
-handle_static_action_clicked (Tile * tile, TileEvent * event, gpointer data)
+static void
+application_startup_cb (GApplication *application,
+ GnomeControlCenter *shell)
{
- gchar *temp;
- AppShellData *app_data = (AppShellData *) data;
- GnomeDesktopItem *item =
- (GnomeDesktopItem *) g_object_get_data (G_OBJECT (tile), APP_ACTION_KEY);
-
- if (event->type == TILE_EVENT_ACTIVATED_DOUBLE_CLICK)
- return;
- open_desktop_item_exec (item);
-
- temp = g_strdup_printf("%s%s", app_data->gconf_prefix, EXIT_SHELL_ON_STATIC_ACTION);
- if (get_slab_gconf_bool(temp))
- {
- if (app_data->exit_on_close)
- gtk_main_quit ();
- else
- hide_shell (app_data);
- }
- g_free (temp);
+ /* nothing to do here, we don't want to show a window before
+ * we've looked at the commandline
+ */
}
-static UniqueResponse
-message_received_cb (UniqueApp *app,
- UniqueCommand command,
- UniqueMessageData *message,
- guint time,
- gpointer user_data)
+int
+main (int argc, char **argv)
{
- UniqueResponse res;
- AppShellData *app_data = user_data;
+ GnomeControlCenter *shell;
+ GtkApplication *application;
+ int status;
- switch (command) {
- case UNIQUE_ACTIVATE:
- /* move the main window to the screen that sent us the command */
- gtk_window_set_screen (GTK_WINDOW (app_data->main_app),
- unique_message_data_get_screen (message));
- if (!app_data->main_app_window_shown_once)
- show_shell (app_data);
-
- gtk_window_present_with_time (GTK_WINDOW (app_data->main_app),
- time);
-
- gtk_widget_grab_focus (SLAB_SECTION (app_data->filter_section)->contents);
-
- res = UNIQUE_RESPONSE_OK;
- break;
- default:
- res = UNIQUE_RESPONSE_PASSTHROUGH;
- break;
- }
+ bindtextdomain (YAST_CC_PACKAGE, YASTLOCALEDIR);
+ bind_textdomain_codeset (YAST_CC_PACKAGE, "UTF-8");
+ bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
+ bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+ textdomain (GETTEXT_PACKAGE);
- return res;
-}
-int
-main (int argc, char *argv[])
-{
- gboolean hidden = FALSE;
- UniqueApp *unique_app;
- AppShellData *app_data;
- GSList *actions;
- GError *error;
- GOptionEntry options[] = {
- { "hide", 0, 0, G_OPTION_ARG_NONE, &hidden, N_("Hide on start (useful to preload the shell)"), NULL },
- { NULL }
- };
-
-#ifdef ENABLE_NLS
- bindtextdomain (YAST_CC_PACKAGE, YASTLOCALEDIR);
- bind_textdomain_codeset (YAST_CC_PACKAGE, "UTF-8");
- bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
- textdomain (GETTEXT_PACKAGE);
-#endif
-
- error = NULL;
- if (!gtk_init_with_args (&argc, &argv,
- NULL, options, GETTEXT_PACKAGE, &error)) {
- g_printerr ("%s\n", error->message);
- g_error_free (error);
- return 1;
- }
-
- /* we don't want to use dbus as a backend for unique, since we're
- * running as root */
- g_setenv ("UNIQUE_BACKEND", "bacon", TRUE);
- unique_app = unique_app_new ("org.opensuse.yast-control-center-gnome", NULL);
- if (unique_app_is_running (unique_app)) {
- int retval = 0;
-
- if (!hidden) {
- UniqueResponse response;
- response = unique_app_send_message (unique_app,
- UNIQUE_ACTIVATE,
- NULL);
- retval = (response != UNIQUE_RESPONSE_OK);
- }
-
- g_object_unref (unique_app);
- return retval;
- }
-
- GtkIconTheme * theme;
- theme = gtk_icon_theme_get_default();
- gtk_icon_theme_prepend_search_path (theme, "/usr/share/YaST2/theme/current");
-
- app_data = appshelldata_new ("YaST-gnome.menu", NULL, CONTROL_CENTER_PREFIX,
- GTK_ICON_SIZE_DND, FALSE, TRUE);
- generate_categories (app_data);
-
- actions = get_actions_list ();
- layout_shell (app_data, _("Filter"), _("Groups"), _("Common Tasks"), actions,
- handle_static_action_clicked);
-
- textdomain (YAST_CC_PACKAGE);
- create_main_window (app_data, "y2ccg-control-center", _("YaST2 Control Center"),
- "yast", 975, 600, hidden);
- textdomain (GETTEXT_PACKAGE);
-
- unique_app_watch_window (unique_app, GTK_WINDOW (app_data->main_app));
- g_signal_connect (unique_app, "message-received",
- G_CALLBACK (message_received_cb), app_data);
+ g_thread_init (NULL);
+ gtk_init (&argc, &argv);
+ cc_shell_log_init ();
- gtk_main ();
+ GtkIconTheme * theme;
+ theme = gtk_icon_theme_get_default();
+ gtk_icon_theme_prepend_search_path (theme, "/usr/share/YaST2/theme/current");
- g_object_unref (unique_app);
+ /* register a symbolic icon size for use in sidebar lists */
+ gtk_icon_size_register ("cc-sidebar-list", 24, 24);
- return 0;
-};
+ shell = gnome_control_center_new ();
+
+ /* enforce single instance of this application */
+ application = gtk_application_new ("org.opensuse.yast-control-center-gnome", G_APPLICATION_HANDLES_COMMAND_LINE);
+ g_signal_connect (application, "startup",
+ G_CALLBACK (application_startup_cb), shell);
+ g_signal_connect (application, "command-line",
+ G_CALLBACK (application_command_line_cb), shell);
+
+ status = g_application_run (G_APPLICATION (application), argc, argv);
+
+ g_object_unref (application);
+
+ return status;
+}
Added: trunk/control-center-gnome/src/gnome-control-center.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/control-center-gnome/src/gnome-c…
==============================================================================
--- trunk/control-center-gnome/src/gnome-control-center.c (added)
+++ trunk/control-center-gnome/src/gnome-control-center.c Mon Jul 25 12:21:36 2011
@@ -0,0 +1,1163 @@
+/*
+ * Copyright (c) 2009, 2010 Intel, Inc.
+ * Copyright (c) 2010 Red Hat, Inc.
+ *
+ * The Control Center is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * The Control Center is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with the Control Center; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author: Thomas Wood <thos(a)gnome.org>
+ */
+
+
+#include "gnome-control-center.h"
+
+#include <glib/gi18n.h>
+#include <gio/gio.h>
+#include <gio/gdesktopappinfo.h>
+#include <gtk/gtk.h>
+#include <gdk/gdkkeysyms.h>
+#include <string.h>
+#define GMENU_I_KNOW_THIS_IS_UNSTABLE
+#include <gmenu-tree.h>
+
+#include <libgnome-control-center/cc-panel.h>
+#include <libgnome-control-center/cc-shell.h>
+#include "shell-search-renderer.h"
+#include "cc-shell-category-view.h"
+#include "cc-shell-model.h"
+
+G_DEFINE_TYPE (GnomeControlCenter, gnome_control_center, CC_TYPE_SHELL)
+
+#define CONTROL_CENTER_PRIVATE(o) \
+ (G_TYPE_INSTANCE_GET_PRIVATE ((o), GNOME_TYPE_CONTROL_CENTER, GnomeControlCenterPrivate))
+
+#define W(b,x) GTK_WIDGET (gtk_builder_get_object (b, x))
+
+enum
+{
+ OVERVIEW_PAGE,
+ SEARCH_PAGE,
+ CAPPLET_PAGE
+};
+
+
+struct _GnomeControlCenterPrivate
+{
+ GtkBuilder *builder;
+ GtkWidget *notebook;
+ GtkWidget *main_vbox;
+ GtkWidget *scrolled_window;
+ GtkWidget *window;
+ GtkWidget *search_entry;
+ GtkWidget *lock_button;
+
+ GMenuTree *menu_tree;
+ GtkListStore *store;
+ GHashTable *category_views;
+
+ GtkTreeModel *search_filter;
+ GtkWidget *search_view;
+ GtkCellRenderer *search_renderer;
+ gchar *filter_string;
+
+ guint32 last_time;
+
+ GIOExtensionPoint *extension_point;
+
+ gchar *default_window_title;
+ gchar *default_window_icon;
+};
+
+/* Use a fixed width for the shell, since resizing horizontally is more awkward
+ * for the user than resizing vertically */
+#define FIXED_WIDTH 675
+
+
+static void
+activate_panel (GnomeControlCenter *shell,
+ const gchar *id,
+ const gchar *desktop_file,
+ const gchar *name,
+ const gchar *icon_name)
+{
+ GDesktopAppInfo *appinfo;
+ GdkAppLaunchContext *context;
+ GdkScreen *screen;
+ GdkDisplay *display;
+ GError *error;
+
+ appinfo = g_desktop_app_info_new_from_filename (desktop_file);
+
+ screen = gtk_widget_get_screen (shell->priv->window);
+ display = gdk_screen_get_display (screen);
+ context = gdk_display_get_app_launch_context (display);
+ gdk_app_launch_context_set_screen (context, screen);
+ gdk_app_launch_context_set_timestamp (context, gtk_get_current_event_time ());
+
+ error = NULL;
+ g_app_info_launch_uris (G_APP_INFO (appinfo), NULL,
+ (GAppLaunchContext *) context,
+ &error);
+
+ if (error) {
+ g_printerr ("Could not launch '%s': %s\n", id, error->message);
+ g_clear_error (&error);
+ }
+
+ g_object_unref (context);
+ g_object_unref (appinfo);
+#if 0
+ GnomeControlCenterPrivate *priv = shell->priv;
+ GType panel_type = G_TYPE_INVALID;
+ GList *panels, *l;
+
+ /* check if there is an plugin that implements this panel */
+ panels = g_io_extension_point_get_extensions (priv->extension_point);
+
+ if (!desktop_file)
+ return;
+
+ if (id)
+ {
+
+ for (l = panels; l != NULL; l = l->next)
+ {
+ GIOExtension *extension;
+ const gchar *name;
+
+ extension = l->data;
+
+ name = g_io_extension_get_name (extension);
+
+ if (!g_strcmp0 (name, id))
+ {
+ panel_type = g_io_extension_get_type (extension);
+ break;
+ }
+ }
+
+ if (panel_type != G_TYPE_INVALID)
+ {
+ GtkWidget *panel;
+ GtkWidget *box;
+ gint i;
+ int nat_height;
+
+ /* create the panel plugin */
+ panel = g_object_new (panel_type, "shell", shell, NULL);
+
+ gtk_lock_button_set_permission (GTK_LOCK_BUTTON (priv->lock_button),
+ cc_panel_get_permission (CC_PANEL (panel)));
+
+ box = gtk_alignment_new (0, 0, 1, 1);
+ gtk_alignment_set_padding (GTK_ALIGNMENT (box), 6, 6, 6, 6);
+
+ gtk_container_add (GTK_CONTAINER (box), panel);
+
+ i = gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook), box,
+ NULL);
+
+ /* switch to the new panel */
+ gtk_widget_show (box);
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->notebook), i);
+
+ /* set the title of the window */
+ gtk_window_set_title (GTK_WINDOW (priv->window), name);
+ gtk_window_set_default_icon_name (icon_name);
+ gtk_window_set_icon_name (GTK_WINDOW (priv->window), icon_name);
+
+ gtk_widget_show (panel);
+
+ /* set the scrolled window small so that it doesn't force
+ the window to be larger than this panel */
+ gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (priv->scrolled_window), 50);
+
+ /* resize to the preferred size of the panel */
+ gtk_widget_set_size_request (priv->window, FIXED_WIDTH, -1);
+ gtk_widget_get_preferred_height (GTK_WIDGET (priv->window),
+ NULL, &nat_height);
+ gtk_window_resize (GTK_WINDOW (priv->window),
+ FIXED_WIDTH,
+ nat_height);
+ return;
+ }
+ else
+ {
+ g_warning ("Could not find the loadable module for panel '%s'", id);
+ }
+ }
+#endif
+}
+
+static void
+shell_show_overview_page (GnomeControlCenterPrivate *priv)
+{
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->notebook), OVERVIEW_PAGE);
+
+ gtk_notebook_remove_page (GTK_NOTEBOOK (priv->notebook), CAPPLET_PAGE);
+
+ /* clear the search text */
+ g_free (priv->filter_string);
+ priv->filter_string = g_strdup ("");
+ gtk_entry_set_text (GTK_ENTRY (priv->search_entry), "");
+
+ gtk_lock_button_set_permission (GTK_LOCK_BUTTON (priv->lock_button), NULL);
+
+ /* reset window title and icon */
+ gtk_window_set_title (GTK_WINDOW (priv->window), priv->default_window_title);
+ gtk_window_set_default_icon_name (priv->default_window_icon);
+ gtk_window_set_icon_name (GTK_WINDOW (priv->window),
+ priv->default_window_icon);
+}
+
+void
+gnome_control_center_set_overview_page (GnomeControlCenter *center)
+{
+ shell_show_overview_page (center->priv);
+}
+
+static void
+item_activated_cb (CcShellCategoryView *view,
+ gchar *name,
+ gchar *id,
+ gchar *desktop_file,
+ GnomeControlCenter *shell)
+{
+ GError *err = NULL;
+
+ if (!cc_shell_set_active_panel_from_id (CC_SHELL (shell), id, &err))
+ {
+ /* TODO: show message to user */
+ if (err)
+ {
+ g_warning ("Could not active panel \"%s\": %s", id, err->message);
+ g_error_free (err);
+ }
+ }
+}
+
+static gboolean
+category_focus_out (GtkWidget *view,
+ GdkEventFocus *event,
+ GnomeControlCenter *shell)
+{
+ gtk_icon_view_unselect_all (GTK_ICON_VIEW (view));
+
+ return FALSE;
+}
+
+static gboolean
+category_focus_in (GtkWidget *view,
+ GdkEventFocus *event,
+ GnomeControlCenter *shell)
+{
+ GtkTreePath *path;
+
+ if (!gtk_icon_view_get_cursor (GTK_ICON_VIEW (view), &path, NULL))
+ {
+ path = gtk_tree_path_new_from_indices (0, -1);
+ gtk_icon_view_set_cursor (GTK_ICON_VIEW (view), path, NULL, FALSE);
+ }
+
+ gtk_icon_view_select_path (GTK_ICON_VIEW (view), path);
+ gtk_tree_path_free (path);
+
+ return FALSE;
+}
+
+static GList *
+get_item_views (GnomeControlCenter *shell)
+{
+ GList *list, *l;
+ GList *res;
+
+ list = gtk_container_get_children (GTK_CONTAINER (shell->priv->main_vbox));
+ res = NULL;
+ for (l = list; l; l = l->next)
+ {
+ res = g_list_append (res, cc_shell_category_view_get_item_view (CC_SHELL_CATEGORY_VIEW (l->data)));
+ }
+
+ g_list_free (list);
+
+ return res;
+}
+
+static gboolean
+keynav_failed (GtkIconView *current_view,
+ GtkDirectionType direction,
+ GnomeControlCenter *shell)
+{
+ GList *views, *v;
+ GtkIconView *new_view;
+ GtkTreePath *path;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ gint col, c, dist, d;
+ GtkTreePath *sel;
+ gboolean res;
+
+ res = FALSE;
+
+ views = get_item_views (shell);
+
+ for (v = views; v; v = v->next)
+ {
+ if (v->data == current_view)
+ break;
+ }
+
+ if (direction == GTK_DIR_DOWN && v != NULL && v->next != NULL)
+ {
+ new_view = v->next->data;
+
+ if (gtk_icon_view_get_cursor (current_view, &path, NULL))
+ {
+ col = gtk_icon_view_get_item_column (current_view, path);
+ gtk_tree_path_free (path);
+
+ sel = NULL;
+ dist = 1000;
+ model = gtk_icon_view_get_model (new_view);
+ gtk_tree_model_get_iter_first (model, &iter);
+ do {
+ path = gtk_tree_model_get_path (model, &iter);
+ c = gtk_icon_view_get_item_column (new_view, path);
+ d = ABS (c - col);
+ if (d < dist)
+ {
+ if (sel)
+ gtk_tree_path_free (sel);
+ sel = path;
+ dist = d;
+ }
+ else
+ gtk_tree_path_free (path);
+ } while (gtk_tree_model_iter_next (model, &iter));
+
+ gtk_icon_view_set_cursor (new_view, sel, NULL, FALSE);
+ gtk_tree_path_free (sel);
+ }
+
+ gtk_widget_grab_focus (GTK_WIDGET (new_view));
+
+ res = TRUE;
+ }
+
+ if (direction == GTK_DIR_UP && v != NULL && v->prev != NULL)
+ {
+ new_view = v->prev->data;
+
+ if (gtk_icon_view_get_cursor (current_view, &path, NULL))
+ {
+ col = gtk_icon_view_get_item_column (current_view, path);
+ gtk_tree_path_free (path);
+
+ sel = NULL;
+ dist = 1000;
+ model = gtk_icon_view_get_model (new_view);
+ gtk_tree_model_get_iter_first (model, &iter);
+ do {
+ path = gtk_tree_model_get_path (model, &iter);
+ c = gtk_icon_view_get_item_column (new_view, path);
+ d = ABS (c - col);
+ if (d <= dist)
+ {
+ if (sel)
+ gtk_tree_path_free (sel);
+ sel = path;
+ dist = d;
+ }
+ else
+ gtk_tree_path_free (path);
+ } while (gtk_tree_model_iter_next (model, &iter));
+
+ gtk_icon_view_set_cursor (new_view, sel, NULL, FALSE);
+ gtk_tree_path_free (sel);
+ }
+
+ gtk_widget_grab_focus (GTK_WIDGET (new_view));
+
+ res = TRUE;
+ }
+
+ g_list_free (views);
+
+ return res;
+}
+
+static gboolean
+model_filter_func (GtkTreeModel *model,
+ GtkTreeIter *iter,
+ GnomeControlCenterPrivate *priv)
+{
+ gchar *name, *target;
+ gchar *needle, *haystack;
+ gboolean result;
+ gchar **keywords;
+
+ gtk_tree_model_get (model, iter, COL_NAME, &name,
+ COL_SEARCH_TARGET, &target,
+ COL_KEYWORDS, &keywords,
+ -1);
+
+ if (!priv->filter_string || !name || !target)
+ {
+ g_free (name);
+ g_free (target);
+ g_strfreev (keywords);
+ return FALSE;
+ }
+
+ needle = g_utf8_casefold (priv->filter_string, -1);
+ haystack = g_utf8_casefold (target, -1);
+
+ result = (strstr (haystack, needle) != NULL);
+
+ if (!result && keywords)
+ {
+ gint i;
+ gchar *keyword;
+
+ for (i = 0; !result && keywords[i]; i++)
+ {
+ keyword = g_utf8_casefold (keywords[i], -1);
+ result = strstr (keyword, needle) == keyword;
+ g_free (keyword);
+ }
+ }
+
+ g_free (name);
+ g_free (target);
+ g_free (haystack);
+ g_free (needle);
+ g_strfreev (keywords);
+
+ return result;
+}
+
+static gboolean
+category_filter_func (GtkTreeModel *model,
+ GtkTreeIter *iter,
+ gchar *filter)
+{
+ gchar *category;
+ gboolean result;
+
+ gtk_tree_model_get (model, iter, COL_CATEGORY, &category, -1);
+
+ result = (g_strcmp0 (category, filter) == 0);
+
+ g_free (category);
+
+ return result;
+}
+
+static void
+search_entry_changed_cb (GtkEntry *entry,
+ GnomeControlCenterPrivate *priv)
+{
+ char *str;
+
+ /* if the entry text was set manually (not by the user) */
+ if (!g_strcmp0 (priv->filter_string, gtk_entry_get_text (entry)))
+ return;
+
+ /* Don't re-filter for added trailing or leading spaces */
+ str = g_strdup (gtk_entry_get_text (entry));
+ g_strstrip (str);
+ if (!g_strcmp0 (str, priv->filter_string))
+ {
+ g_free (str);
+ return;
+ }
+
+ g_free (priv->filter_string);
+ priv->filter_string = str;
+
+ g_object_set (priv->search_renderer,
+ "search-string", priv->filter_string,
+ NULL);
+
+ if (!g_strcmp0 (priv->filter_string, ""))
+ {
+ shell_show_overview_page (priv);
+ g_object_set (G_OBJECT (entry),
+ "secondary-icon-name", "edit-find-symbolic",
+ "secondary-icon-activatable", FALSE,
+ "secondary-icon-sensitive", FALSE,
+ NULL);
+ }
+ else
+ {
+ gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (priv->search_filter));
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->notebook),
+ SEARCH_PAGE);
+ g_object_set (G_OBJECT (entry),
+ "secondary-icon-name", "edit-clear-symbolic",
+ "secondary-icon-activatable", TRUE,
+ "secondary-icon-sensitive", TRUE,
+ NULL);
+ }
+}
+
+static gboolean
+search_entry_key_press_event_cb (GtkEntry *entry,
+ GdkEventKey *event,
+ GnomeControlCenterPrivate *priv)
+{
+ if (event->keyval == GDK_KEY_Return)
+ {
+ GtkTreePath *path;
+
+ path = gtk_tree_path_new_first ();
+
+ priv->last_time = event->time;
+
+ gtk_icon_view_item_activated (GTK_ICON_VIEW (priv->search_view), path);
+
+ gtk_tree_path_free (path);
+ return TRUE;
+ }
+
+ if (event->keyval == GDK_KEY_Escape)
+ {
+ gtk_entry_set_text (entry, "");
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+static void
+search_entry_clear_cb (GtkEntry *entry)
+{
+ gtk_entry_set_text (entry, "");
+}
+
+
+static void
+setup_search (GnomeControlCenter *shell)
+{
+ GtkWidget *search_scrolled, *search_view, *widget;
+ GnomeControlCenterPrivate *priv = shell->priv;
+
+ g_return_if_fail (priv->store != NULL);
+
+ /* create the search filter */
+ priv->search_filter = gtk_tree_model_filter_new (GTK_TREE_MODEL (priv->store),
+ NULL);
+
+ gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER (priv->search_filter),
+ (GtkTreeModelFilterVisibleFunc)
+ model_filter_func,
+ priv, NULL);
+
+ /* set up the search view */
+ priv->search_view = search_view = cc_shell_item_view_new ();
+ gtk_icon_view_set_item_orientation (GTK_ICON_VIEW (search_view),
+ GTK_ORIENTATION_HORIZONTAL);
+ gtk_icon_view_set_spacing (GTK_ICON_VIEW (search_view), 6);
+ gtk_icon_view_set_model (GTK_ICON_VIEW (search_view),
+ GTK_TREE_MODEL (priv->search_filter));
+ gtk_icon_view_set_pixbuf_column (GTK_ICON_VIEW (search_view), COL_PIXBUF);
+
+ search_scrolled = W (priv->builder, "search-scrolled-window");
+ gtk_container_add (GTK_CONTAINER (search_scrolled), search_view);
+
+ /* add the custom renderer */
+ priv->search_renderer = (GtkCellRenderer*) shell_search_renderer_new ();
+ gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (search_view),
+ priv->search_renderer, TRUE);
+ gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (search_view),
+ priv->search_renderer,
+ "title", COL_NAME);
+ gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (search_view),
+ priv->search_renderer,
+ "search-target", COL_SEARCH_TARGET);
+
+ /* connect the activated signal */
+ g_signal_connect (search_view, "desktop-item-activated",
+ G_CALLBACK (item_activated_cb), shell);
+
+ /* setup the search entry widget */
+ widget = (GtkWidget*) gtk_builder_get_object (priv->builder, "search-entry");
+ priv->search_entry = widget;
+ priv->filter_string = g_strdup ("");
+
+ g_signal_connect (widget, "changed", G_CALLBACK (search_entry_changed_cb),
+ priv);
+ g_signal_connect (widget, "key-press-event",
+ G_CALLBACK (search_entry_key_press_event_cb), priv);
+
+ g_signal_connect (widget, "icon-release", G_CALLBACK (search_entry_clear_cb),
+ priv);
+}
+
+static void
+setup_lock (GnomeControlCenter *shell)
+{
+ GnomeControlCenterPrivate *priv = shell->priv;
+
+ priv->lock_button = W (priv->builder, "lock-button");
+}
+
+static void
+maybe_add_category_view (GnomeControlCenter *shell,
+ const char *name)
+{
+ GtkTreeModel *filter;
+ GtkWidget *categoryview;
+
+ if (g_hash_table_lookup (shell->priv->category_views, name) != NULL)
+ return;
+
+ /* create new category view for this category */
+ filter = gtk_tree_model_filter_new (GTK_TREE_MODEL (shell->priv->store),
+ NULL);
+ gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER (filter),
+ (GtkTreeModelFilterVisibleFunc) category_filter_func,
+ g_strdup (name), g_free);
+
+ categoryview = cc_shell_category_view_new (name, filter);
+ gtk_box_pack_start (GTK_BOX (shell->priv->main_vbox), categoryview, FALSE, TRUE, 0);
+
+ g_signal_connect (cc_shell_category_view_get_item_view (CC_SHELL_CATEGORY_VIEW (categoryview)),
+ "desktop-item-activated",
+ G_CALLBACK (item_activated_cb), shell);
+
+ gtk_widget_show (categoryview);
+
+ g_signal_connect (cc_shell_category_view_get_item_view (CC_SHELL_CATEGORY_VIEW (categoryview)),
+ "focus-in-event",
+ G_CALLBACK (category_focus_in), shell);
+ g_signal_connect (cc_shell_category_view_get_item_view (CC_SHELL_CATEGORY_VIEW (categoryview)),
+ "focus-out-event",
+ G_CALLBACK (category_focus_out), shell);
+ g_signal_connect (cc_shell_category_view_get_item_view (CC_SHELL_CATEGORY_VIEW (categoryview)),
+ "keynav-failed",
+ G_CALLBACK (keynav_failed), shell);
+
+ g_hash_table_insert (shell->priv->category_views, g_strdup (name), categoryview);
+}
+
+static void
+reload_menu (GnomeControlCenter *shell)
+{
+ GSList *list, *l;
+ GMenuTreeDirectory *d;
+
+ d = gmenu_tree_get_root_directory (shell->priv->menu_tree);
+ list = gmenu_tree_directory_get_contents (d);
+
+ for (l = list; l; l = l->next)
+ {
+ GMenuTreeItemType type;
+ type = gmenu_tree_item_get_type (l->data);
+
+ if (type == GMENU_TREE_ITEM_DIRECTORY)
+ {
+ GSList *contents, *f;
+ const gchar *dir_name;
+
+ contents = gmenu_tree_directory_get_contents (l->data);
+ dir_name = gmenu_tree_directory_get_name (l->data);
+
+ maybe_add_category_view (shell, dir_name);
+
+ /* add the items from this category to the model */
+ for (f = contents; f; f = f->next)
+ {
+ if (gmenu_tree_item_get_type (f->data) == GMENU_TREE_ITEM_ENTRY)
+ {
+ cc_shell_model_add_item (CC_SHELL_MODEL (shell->priv->store),
+ dir_name,
+ f->data);
+ }
+ }
+
+ g_slist_free (contents);
+ }
+ }
+
+ g_slist_free (list);
+}
+
+static void
+on_menu_changed (GMenuTree *monitor,
+ GnomeControlCenter *shell)
+{
+ gtk_list_store_clear (shell->priv->store);
+ reload_menu (shell);
+}
+
+static void
+setup_model (GnomeControlCenter *shell)
+{
+ GnomeControlCenterPrivate *priv = shell->priv;
+
+ gtk_container_set_border_width (GTK_CONTAINER (shell->priv->main_vbox), 10);
+ gtk_container_set_focus_vadjustment (GTK_CONTAINER (shell->priv->main_vbox),
+ gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (shell->priv->scrolled_window)));
+
+ priv->store = (GtkListStore *) cc_shell_model_new ();
+ priv->category_views = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+ priv->menu_tree = gmenu_tree_lookup ("YaST-gnome.menu", 0);
+
+ if (priv->menu_tree == NULL)
+ {
+ g_warning ("Could not find control center menu");
+ return;
+ }
+
+ reload_menu (shell);
+
+ gmenu_tree_add_monitor (priv->menu_tree, (GMenuTreeChangedFunc)on_menu_changed, shell);
+}
+
+static void
+load_panel_plugins (GnomeControlCenter *shell)
+{
+#if 0
+ GList *modules;
+
+ /* only allow this function to be run once to prevent modules being loaded
+ * twice
+ */
+ if (shell->priv->extension_point)
+ return;
+
+ /* make sure the base type is registered */
+ g_type_from_name ("CcPanel");
+
+ shell->priv->extension_point
+ = g_io_extension_point_register (CC_SHELL_PANEL_EXTENSION_POINT);
+
+ /* load all the plugins in the panels directory */
+ modules = g_io_modules_load_all_in_directory (PANELS_DIR);
+ g_list_free (modules);
+
+#endif
+}
+
+
+static void
+home_button_clicked_cb (GtkButton *button,
+ GnomeControlCenter *shell)
+{
+ shell_show_overview_page (shell->priv);
+}
+
+static void
+notebook_switch_page_cb (GtkNotebook *book,
+ GtkWidget *child,
+ gint page_num,
+ GnomeControlCenterPrivate *priv)
+{
+ /* make sure the home button is shown on all pages except the overview page */
+
+ if (page_num == OVERVIEW_PAGE || page_num == SEARCH_PAGE)
+ {
+ gtk_widget_hide (W (priv->builder, "home-button"));
+ gtk_widget_show (W (priv->builder, "search-entry"));
+ gtk_widget_hide (W (priv->builder, "lock-button"));
+ }
+ else
+ {
+ gtk_widget_show (W (priv->builder, "home-button"));
+ gtk_widget_hide (W (priv->builder, "search-entry"));
+ }
+}
+
+/* CcShell implementation */
+static gboolean
+_shell_set_active_panel_from_id (CcShell *shell,
+ const gchar *start_id,
+ GError **err)
+{
+ GtkTreeIter iter;
+ gboolean iter_valid;
+ gchar *name = NULL;
+ gchar *desktop, *icon_name;
+ GnomeControlCenterPrivate *priv = GNOME_CONTROL_CENTER (shell)->priv;
+
+
+ iter_valid = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (priv->store),
+ &iter);
+
+ /* find the details for this item */
+ while (iter_valid)
+ {
+ gchar *id;
+
+ gtk_tree_model_get (GTK_TREE_MODEL (priv->store), &iter,
+ COL_NAME, &name,
+ COL_DESKTOP_FILE, &desktop,
+ COL_ICON_NAME, &icon_name,
+ COL_ID, &id,
+ -1);
+
+ if (id && !strcmp (id, start_id))
+ {
+ g_free (id);
+ break;
+ }
+ else
+ {
+ g_free (id);
+ g_free (name);
+ g_free (desktop);
+ g_free (icon_name);
+
+ name = NULL;
+ id = NULL;
+ }
+
+ iter_valid = gtk_tree_model_iter_next (GTK_TREE_MODEL (priv->store),
+ &iter);
+ }
+
+ if (!name)
+ {
+ g_warning ("Could not find settings panel \"%s\"", start_id);
+ return FALSE;
+ }
+ else
+ {
+ gtk_notebook_remove_page (GTK_NOTEBOOK (priv->notebook), CAPPLET_PAGE);
+
+ activate_panel (GNOME_CONTROL_CENTER (shell), start_id, desktop, name,
+ icon_name);
+
+ g_free (name);
+ g_free (desktop);
+ g_free (icon_name);
+
+ return TRUE;
+ }
+}
+
+static GtkWidget *
+_shell_get_toplevel (CcShell *shell)
+{
+ return GNOME_CONTROL_CENTER (shell)->priv->window;
+}
+
+/* GObject Implementation */
+static void
+gnome_control_center_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id)
+ {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ }
+}
+
+static void
+gnome_control_center_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id)
+ {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ }
+}
+
+static void
+gnome_control_center_dispose (GObject *object)
+{
+ GnomeControlCenterPrivate *priv = GNOME_CONTROL_CENTER (object)->priv;
+
+ if (priv->window)
+ {
+ gtk_widget_destroy (priv->window);
+ priv->window = NULL;
+
+ /* destroying the window will destroy its children */
+ priv->notebook = NULL;
+ priv->search_entry = NULL;
+ priv->search_view = NULL;
+ priv->search_renderer = NULL;
+ }
+
+ if (priv->builder)
+ {
+ g_object_unref (priv->builder);
+ priv->builder = NULL;
+ }
+
+ if (priv->store)
+ {
+ g_object_unref (priv->store);
+ priv->store = NULL;
+ }
+
+ if (priv->search_filter)
+ {
+ g_object_unref (priv->search_filter);
+ priv->search_filter = NULL;
+ }
+
+
+ G_OBJECT_CLASS (gnome_control_center_parent_class)->dispose (object);
+}
+
+static void
+gnome_control_center_finalize (GObject *object)
+{
+ GnomeControlCenterPrivate *priv = GNOME_CONTROL_CENTER (object)->priv;
+
+ if (priv->filter_string)
+ {
+ g_free (priv->filter_string);
+ priv->filter_string = NULL;
+ }
+
+ if (priv->default_window_title)
+ {
+ g_free (priv->default_window_title);
+ priv->default_window_title = NULL;
+ }
+
+ if (priv->default_window_icon)
+ {
+ g_free (priv->default_window_icon);
+ priv->default_window_icon = NULL;
+ }
+
+ if (priv->menu_tree)
+ {
+ gmenu_tree_remove_monitor (priv->menu_tree, (GMenuTreeChangedFunc)on_menu_changed, object);
+ gmenu_tree_unref (priv->menu_tree);
+ }
+
+ if (priv->category_views)
+ {
+ g_hash_table_destroy (priv->category_views);
+ }
+
+ G_OBJECT_CLASS (gnome_control_center_parent_class)->finalize (object);
+}
+
+static void
+gnome_control_center_class_init (GnomeControlCenterClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ CcShellClass *shell_class = CC_SHELL_CLASS (klass);
+
+ g_type_class_add_private (klass, sizeof (GnomeControlCenterPrivate));
+
+ object_class->get_property = gnome_control_center_get_property;
+ object_class->set_property = gnome_control_center_set_property;
+ object_class->dispose = gnome_control_center_dispose;
+ object_class->finalize = gnome_control_center_finalize;
+
+ shell_class->set_active_panel_from_id = _shell_set_active_panel_from_id;
+ shell_class->get_toplevel = _shell_get_toplevel;
+}
+
+static gboolean
+queue_resize (gpointer data)
+{
+ GtkWidget *widget = data;
+
+ gtk_widget_queue_resize (widget);
+
+ return FALSE;
+}
+
+static void
+on_window_size_allocate (GtkWidget *widget,
+ GtkAllocation *allocation,
+ GnomeControlCenter *self)
+{
+ int height;
+
+ if (gtk_notebook_get_current_page (GTK_NOTEBOOK (self->priv->notebook)) == OVERVIEW_PAGE)
+ {
+ gtk_widget_get_preferred_height_for_width (GTK_WIDGET (self->priv->main_vbox),
+ FIXED_WIDTH,
+ NULL,
+ &height);
+ if (gtk_widget_get_realized (widget))
+ {
+ int monitor;
+ GdkScreen *screen;
+ GdkRectangle rect;
+ GdkWindow *window;
+
+ window = gtk_widget_get_window (widget);
+ screen = gtk_widget_get_screen (widget);
+ monitor = gdk_screen_get_monitor_at_window (screen, window);
+ gdk_screen_get_monitor_geometry (screen, monitor, &rect);
+ height = (rect.height * 3) / 5;
+ } else {
+ int monitor;
+ GdkScreen *screen;
+ GdkRectangle rect;
+
+ screen = gdk_screen_get_default ();
+ monitor = gdk_screen_get_primary_monitor (screen);
+ gdk_screen_get_monitor_geometry (screen, monitor, &rect);
+ height = (rect.height * 3) / 5;
+ }
+ }
+ else
+ {
+ height = 50;
+ }
+
+ if (gtk_scrolled_window_get_min_content_height (GTK_SCROLLED_WINDOW (self->priv->scrolled_window)) != height)
+ {
+ gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (self->priv->scrolled_window), height);
+ /*
+ * Queueing a resize out of size-allocate is ignored,
+ * so we have to defer to an idle.
+ */
+ g_idle_add (queue_resize, self->priv->scrolled_window);
+ }
+}
+
+static void
+viewport_style_set_cb (GtkWidget *widget,
+ GtkStyle *old_style,
+ gpointer user_data)
+{
+ GtkStyle *style;
+
+ /* use "base" colours inside the viewport */
+
+ g_signal_handlers_block_by_func (widget, viewport_style_set_cb, NULL);
+
+ style = gtk_widget_get_style (widget);
+
+ gtk_widget_modify_bg (widget, GTK_STATE_NORMAL,
+ &style->base[GTK_STATE_NORMAL]);
+
+ g_signal_handlers_unblock_by_func (widget, viewport_style_set_cb, NULL);
+}
+
+static gboolean
+window_key_press_event (GtkWidget *win,
+ GdkEventKey *event,
+ GnomeControlCenter *self)
+{
+ gboolean retval;
+
+ retval = FALSE;
+
+ if (!gtk_widget_get_visible (self->priv->search_entry))
+ return retval;
+
+ if (event->state != 0 &&
+ (event->state & GDK_CONTROL_MASK))
+ {
+ switch (event->keyval)
+ {
+ case GDK_KEY_s:
+ case GDK_KEY_S:
+ case GDK_KEY_f:
+ case GDK_KEY_F:
+ gtk_widget_grab_focus (self->priv->search_entry);
+ retval = TRUE;
+ break;
+ }
+ }
+ return retval;
+}
+
+static void
+gnome_control_center_init (GnomeControlCenter *self)
+{
+ GtkWidget *widget;
+ GError *err = NULL;
+ GnomeControlCenterPrivate *priv;
+
+ priv = self->priv = CONTROL_CENTER_PRIVATE (self);
+
+ /* load the user interface */
+ priv->builder = gtk_builder_new ();
+
+ if (!gtk_builder_add_from_file (priv->builder, UIDIR "/shell.ui", &err))
+ {
+ g_critical ("Could not build interface: %s", err->message);
+ g_error_free (err);
+
+ return;
+ }
+
+ /* connect various signals */
+ priv->window = W (priv->builder, "main-window");
+ g_signal_connect_swapped (priv->window, "delete-event", G_CALLBACK (g_object_unref), self);
+ g_signal_connect (priv->window, "key_press_event",
+ G_CALLBACK (window_key_press_event), self);
+
+ priv->notebook = W (priv->builder, "notebook");
+ priv->scrolled_window = W (priv->builder, "scrolledwindow1");
+
+ widget = W (priv->builder, "viewport");
+ g_signal_connect (widget, "style-set", G_CALLBACK (viewport_style_set_cb),
+ NULL);
+
+ gtk_widget_set_size_request (priv->scrolled_window, FIXED_WIDTH, -1);
+ priv->main_vbox = W (priv->builder, "main-vbox");
+ g_signal_connect (priv->scrolled_window, "size-allocate", G_CALLBACK (on_window_size_allocate), self);
+ g_signal_connect (priv->notebook, "switch-page",
+ G_CALLBACK (notebook_switch_page_cb), priv);
+
+ g_signal_connect (gtk_builder_get_object (priv->builder, "home-button"),
+ "clicked", G_CALLBACK (home_button_clicked_cb), self);
+
+ /* load the available settings panels */
+ setup_model (self);
+
+ /* load the panels that are implemented as plugins */
+ load_panel_plugins (self);
+
+ /* setup search functionality */
+ setup_search (self);
+
+ setup_lock (self);
+
+ /* store default window title and name */
+ priv->default_window_title = g_strdup (gtk_window_get_title (GTK_WINDOW (priv->window)));
+ priv->default_window_icon = g_strdup (gtk_window_get_icon_name (GTK_WINDOW (priv->window)));
+}
+
+GnomeControlCenter *
+gnome_control_center_new (void)
+{
+ return g_object_new (GNOME_TYPE_CONTROL_CENTER, NULL);
+}
+
+void
+gnome_control_center_present (GnomeControlCenter *center)
+{
+ gtk_window_present (GTK_WINDOW (center->priv->window));
+}
+
+void
+gnome_control_center_show (GnomeControlCenter *center,
+ GtkApplication *app)
+{
+ gtk_window_set_application (GTK_WINDOW (center->priv->window), app);
+ gtk_widget_show_all (gtk_bin_get_child (GTK_BIN (center->priv->window)));
+}
Added: trunk/control-center-gnome/src/gnome-control-center.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/control-center-gnome/src/gnome-c…
==============================================================================
--- trunk/control-center-gnome/src/gnome-control-center.h (added)
+++ trunk/control-center-gnome/src/gnome-control-center.h Mon Jul 25 12:21:36 2011
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2010 Intel, Inc.
+ *
+ * The Control Center is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * The Control Center is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with the Control Center; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author: Thomas Wood <thos(a)gnome.org>
+ */
+
+#ifndef _GNOME_CONTROL_CENTER_H
+#define _GNOME_CONTROL_CENTER_H
+
+#include <glib-object.h>
+#include <libgnome-control-center/cc-shell.h>
+
+G_BEGIN_DECLS
+
+#define GNOME_TYPE_CONTROL_CENTER gnome_control_center_get_type()
+
+#define GNOME_CONTROL_CENTER(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ GNOME_TYPE_CONTROL_CENTER, GnomeControlCenter))
+
+#define GNOME_CONTROL_CENTER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST ((klass), \
+ GNOME_TYPE_CONTROL_CENTER, GnomeControlCenterClass))
+
+#define GNOME_IS_CONTROL_CENTER(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+ GNOME_TYPE_CONTROL_CENTER))
+
+#define GNOME_IS_CONTROL_CENTER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+ GNOME_TYPE_CONTROL_CENTER))
+
+#define GNOME_CONTROL_CENTER_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ GNOME_TYPE_CONTROL_CENTER, GnomeControlCenterClass))
+
+typedef struct _GnomeControlCenter GnomeControlCenter;
+typedef struct _GnomeControlCenterClass GnomeControlCenterClass;
+typedef struct _GnomeControlCenterPrivate GnomeControlCenterPrivate;
+
+struct _GnomeControlCenter
+{
+ CcShell parent;
+
+ GnomeControlCenterPrivate *priv;
+};
+
+struct _GnomeControlCenterClass
+{
+ CcShellClass parent_class;
+};
+
+GType gnome_control_center_get_type (void) G_GNUC_CONST;
+
+GnomeControlCenter *gnome_control_center_new (void);
+
+void gnome_control_center_present (GnomeControlCenter *center);
+
+void gnome_control_center_show (GnomeControlCenter *center, GtkApplication *app);
+
+void gnome_control_center_set_overview_page (GnomeControlCenter *center);
+
+G_END_DECLS
+
+#endif /* _GNOME_CONTROL_CENTER_H */
Added: trunk/control-center-gnome/src/shell-search-renderer.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/control-center-gnome/src/shell-s…
==============================================================================
--- trunk/control-center-gnome/src/shell-search-renderer.c (added)
+++ trunk/control-center-gnome/src/shell-search-renderer.c Mon Jul 25 12:21:36 2011
@@ -0,0 +1,351 @@
+/*
+ * Copyright (c) 2010 Intel, Inc.
+ *
+ * The Control Center is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * The Control Center is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with the Control Center; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author: Thomas Wood <thos(a)gnome.org>
+ */
+
+#include "shell-search-renderer.h"
+#include <string.h>
+
+G_DEFINE_TYPE (ShellSearchRenderer, shell_search_renderer, GTK_TYPE_CELL_RENDERER_TEXT)
+
+#define SEARCH_RENDERER_PRIVATE(o) \
+ (G_TYPE_INSTANCE_GET_PRIVATE ((o), SHELL_TYPE_SEARCH_RENDERER, ShellSearchRendererPrivate))
+
+struct _ShellSearchRendererPrivate
+{
+ gchar *title;
+ gchar *search_target;
+ gchar *search_string;
+
+ PangoLayout *layout;
+};
+
+enum
+{
+ PROP_TITLE = 1,
+ PROP_SEARCH_TARGET,
+ PROP_SEARCH_STRING
+};
+
+
+static void
+shell_search_renderer_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id)
+ {
+ case PROP_TITLE:
+ case PROP_SEARCH_TARGET:
+ case PROP_SEARCH_STRING:
+ break;
+
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ }
+}
+
+static void
+shell_search_renderer_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ ShellSearchRendererPrivate *priv = SHELL_SEARCH_RENDERER (object)->priv;
+
+ switch (property_id)
+ {
+ case PROP_TITLE:
+ g_free (priv->title);
+ priv->title = g_value_dup_string (value);
+ /* set GtkCellRendererText::text for a11y */
+ g_object_set (object, "text", priv->title, NULL);
+ break;
+
+ case PROP_SEARCH_TARGET:
+ g_free (priv->search_target);
+ priv->search_target = g_value_dup_string (value);
+ break;
+
+ case PROP_SEARCH_STRING:
+ g_free (priv->search_string);
+ priv->search_string = g_value_dup_string (value);
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ }
+}
+
+static void
+shell_search_renderer_dispose (GObject *object)
+{
+ ShellSearchRendererPrivate *priv = SHELL_SEARCH_RENDERER (object)->priv;
+
+ if (priv->layout)
+ {
+ g_object_unref (priv->layout);
+ priv->layout = NULL;
+ }
+
+ G_OBJECT_CLASS (shell_search_renderer_parent_class)->dispose (object);
+}
+
+static void
+shell_search_renderer_finalize (GObject *object)
+{
+ ShellSearchRendererPrivate *priv = SHELL_SEARCH_RENDERER (object)->priv;
+
+ if (priv->title)
+ {
+ g_free (priv->title);
+ priv->title = NULL;
+ }
+
+ if (priv->search_target)
+ {
+ g_free (priv->search_target);
+ priv->search_target = NULL;
+ }
+
+ if (priv->search_string)
+ {
+ g_free (priv->search_string);
+ priv->search_string = NULL;
+ }
+
+ G_OBJECT_CLASS (shell_search_renderer_parent_class)->finalize (object);
+}
+
+static void
+shell_search_renderer_set_layout (ShellSearchRenderer *cell, GtkWidget *widget)
+{
+ gchar *display_string;
+ ShellSearchRendererPrivate *priv = cell->priv;
+ gchar *needle, *haystack;
+ gchar *full_string;
+
+ if (!priv->layout)
+ {
+ priv->layout = pango_layout_new (gtk_widget_get_pango_context (widget));
+ pango_layout_set_ellipsize (priv->layout, PANGO_ELLIPSIZE_END);
+ }
+
+ full_string = priv->search_target;
+
+ if (priv->search_string != NULL)
+ needle = g_utf8_casefold (priv->search_string, -1);
+ else
+ needle = NULL;
+ haystack = g_utf8_casefold (full_string, -1);
+
+ /* clear any previous attributes */
+ pango_layout_set_attributes (priv->layout, NULL);
+
+ if (priv->search_string && priv->title
+ && (strstr (haystack, needle)))
+ {
+ gchar *start;
+ gchar *lead, *trail, *leaddot;
+ gchar *match;
+ gint count;
+
+#define CONTEXT 10
+
+ count = strlen (needle);
+ start = full_string + (strstr (haystack, needle) - haystack);
+
+ lead = MAX (start - CONTEXT, full_string);
+ trail = start + count;
+
+ if (lead == full_string)
+ leaddot = "";
+ else
+ leaddot = "â¦";
+
+ match = g_strndup (start, count);
+ lead = g_strndup (lead, start - lead);
+
+ display_string = g_markup_printf_escaped ("%s\n"
+ "<small>%s%s<b>%s</b>%s</small>",
+ priv->title, leaddot, lead,
+ match, trail);
+
+ g_free (match);
+ g_free (lead);
+ }
+ else
+ display_string = g_markup_escape_text (priv->title, -1);
+
+
+ pango_layout_set_markup (priv->layout, display_string, -1);
+ g_free (display_string);
+ g_free (needle);
+ g_free (haystack);
+}
+
+static void
+get_size (GtkCellRenderer *cell,
+ GtkWidget *widget,
+ gint *width,
+ gint *height)
+{
+ ShellSearchRendererPrivate *priv = SHELL_SEARCH_RENDERER (cell)->priv;
+ PangoRectangle rect;
+
+ shell_search_renderer_set_layout (SHELL_SEARCH_RENDERER (cell), widget);
+
+ pango_layout_set_width (priv->layout, PANGO_SCALE * 180);
+ pango_layout_get_pixel_extents (priv->layout, NULL, &rect);
+
+ if (width) *width = rect.width;
+ if (height) *height = rect.height;
+}
+
+static void
+shell_search_renderer_get_preferred_width (GtkCellRenderer *cell,
+ GtkWidget *widget,
+ gint *minimum_size,
+ gint *natural_size)
+{
+ gint width;
+
+ get_size (cell, widget, &width, NULL);
+ if (minimum_size) *minimum_size = width;
+ if (natural_size) *natural_size = width;
+}
+
+static void
+shell_search_renderer_get_preferred_height (GtkCellRenderer *cell,
+ GtkWidget *widget,
+ gint *minimum_size,
+ gint *natural_size)
+{
+ gint height;
+
+ get_size (cell, widget, NULL, &height);
+ if (minimum_size) *minimum_size = height;
+ if (natural_size) *natural_size = height;
+}
+
+static void
+shell_search_renderer_get_preferred_height_for_width (GtkCellRenderer *cell,
+ GtkWidget *widget,
+ gint width,
+ gint *minimum_height,
+ gint *natural_height)
+{
+ shell_search_renderer_get_preferred_height (cell, widget, minimum_height, natural_height);
+}
+
+static void
+shell_search_renderer_get_aligned_area (GtkCellRenderer *cell,
+ GtkWidget *widget,
+ GtkCellRendererState flags,
+ const GdkRectangle *cell_area,
+ GdkRectangle *aligned_area)
+{
+ get_size (cell, widget, &aligned_area->width, &aligned_area->height);
+ aligned_area->x = cell_area->x;
+ aligned_area->y = cell_area->y;
+}
+
+static void
+shell_search_renderer_render (GtkCellRenderer *cell,
+ cairo_t *cr,
+ GtkWidget *widget,
+ const GdkRectangle *background_area,
+ const GdkRectangle *cell_area,
+ GtkCellRendererState flags)
+{
+ ShellSearchRendererPrivate *priv = SHELL_SEARCH_RENDERER (cell)->priv;
+ PangoRectangle rect;
+ GtkStyleContext *context;
+
+ context = gtk_widget_get_style_context (widget);
+
+ shell_search_renderer_set_layout (SHELL_SEARCH_RENDERER (cell), widget);
+
+ pango_layout_get_pixel_extents (priv->layout, NULL, &rect);
+
+ cairo_save (cr);
+
+ gtk_render_layout (context, cr,
+ cell_area->x,
+ cell_area->y,
+ priv->layout);
+
+ cairo_restore (cr);
+}
+
+static void
+shell_search_renderer_class_init (ShellSearchRendererClass *klass)
+{
+ GParamSpec *pspec;
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GtkCellRendererClass *cell_renderer = GTK_CELL_RENDERER_CLASS (klass);
+
+ g_type_class_add_private (klass, sizeof (ShellSearchRendererPrivate));
+
+ object_class->get_property = shell_search_renderer_get_property;
+ object_class->set_property = shell_search_renderer_set_property;
+ object_class->dispose = shell_search_renderer_dispose;
+ object_class->finalize = shell_search_renderer_finalize;
+
+ cell_renderer->get_preferred_width = shell_search_renderer_get_preferred_width;
+ cell_renderer->get_preferred_height = shell_search_renderer_get_preferred_height;
+ cell_renderer->get_preferred_height_for_width = shell_search_renderer_get_preferred_height_for_width;
+ cell_renderer->get_aligned_area = shell_search_renderer_get_aligned_area;
+
+ cell_renderer->render = shell_search_renderer_render;
+
+ pspec = g_param_spec_string ("title",
+ "Title",
+ "Item title",
+ "",
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+ g_object_class_install_property (object_class, PROP_TITLE, pspec);
+
+ pspec = g_param_spec_string ("search-target",
+ "Search Target",
+ "The string that will be searched",
+ "",
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+ g_object_class_install_property (object_class, PROP_SEARCH_TARGET, pspec);
+
+ pspec = g_param_spec_string ("search-string",
+ "Search String",
+ "Current search string",
+ "",
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+ g_object_class_install_property (object_class, PROP_SEARCH_STRING, pspec);
+}
+
+static void
+shell_search_renderer_init (ShellSearchRenderer *self)
+{
+ self->priv = SEARCH_RENDERER_PRIVATE (self);
+}
+
+ShellSearchRenderer *
+shell_search_renderer_new (void)
+{
+ return g_object_new (SHELL_TYPE_SEARCH_RENDERER, NULL);
+}
Added: trunk/control-center-gnome/src/shell-search-renderer.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/control-center-gnome/src/shell-s…
==============================================================================
--- trunk/control-center-gnome/src/shell-search-renderer.h (added)
+++ trunk/control-center-gnome/src/shell-search-renderer.h Mon Jul 25 12:21:36 2011
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2010 Intel, Inc.
+ *
+ * The Control Center is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * The Control Center is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with the Control Center; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author: Thomas Wood <thos(a)gnome.org>
+ */
+
+#ifndef _SHELL_SEARCH_RENDERER_H
+#define _SHELL_SEARCH_RENDERER_H
+
+#include <glib-object.h>
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define SHELL_TYPE_SEARCH_RENDERER shell_search_renderer_get_type()
+
+#define SHELL_SEARCH_RENDERER(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ SHELL_TYPE_SEARCH_RENDERER, ShellSearchRenderer))
+
+#define SHELL_SEARCH_RENDERER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST ((klass), \
+ SHELL_TYPE_SEARCH_RENDERER, ShellSearchRendererClass))
+
+#define SHELL_IS_SEARCH_RENDERER(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+ SHELL_TYPE_SEARCH_RENDERER))
+
+#define SHELL_IS_SEARCH_RENDERER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+ SHELL_TYPE_SEARCH_RENDERER))
+
+#define SHELL_SEARCH_RENDERER_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ SHELL_TYPE_SEARCH_RENDERER, ShellSearchRendererClass))
+
+typedef struct _ShellSearchRenderer ShellSearchRenderer;
+typedef struct _ShellSearchRendererClass ShellSearchRendererClass;
+typedef struct _ShellSearchRendererPrivate ShellSearchRendererPrivate;
+
+struct _ShellSearchRenderer
+{
+ GtkCellRendererText parent;
+
+ ShellSearchRendererPrivate *priv;
+};
+
+struct _ShellSearchRendererClass
+{
+ GtkCellRendererTextClass parent_class;
+};
+
+GType shell_search_renderer_get_type (void) G_GNUC_CONST;
+
+ShellSearchRenderer *shell_search_renderer_new (void);
+
+G_END_DECLS
+
+#endif /* _SHELL_SEARCH_RENDERER_H */
Added: trunk/control-center-gnome/src/shell.ui
URL: http://svn.opensuse.org/viewcvs/yast/trunk/control-center-gnome/src/shell.u…
==============================================================================
--- trunk/control-center-gnome/src/shell.ui (added)
+++ trunk/control-center-gnome/src/shell.ui Mon Jul 25 12:21:36 2011
@@ -0,0 +1,173 @@
+<?xml version="1.0"?>
+<interface>
+ <requires lib="gtk+" version="2.16"/>
+ <!-- interface-naming-policy project-wide -->
+ <object class="GtkWindow" id="main-window">
+ <property name="title" translatable="yes">Administrator Settings</property>
+ <property name="resizable">True</property>
+ <property name="icon_name">yast</property>
+ <property name="window_position">center</property>
+ <child>
+ <object class="GtkVBox" id="vbox1">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkToolbar" id="toolbar1">
+ <property name="visible">True</property>
+ <style>
+ <class name="primary-toolbar"/>
+ </style>
+ <child>
+ <object class="GtkToolItem" id="toolbutton1">
+ <property name="visible">True</property>
+ <style>
+ <class name="raised"/>
+ </style>
+ <child>
+ <object class="GtkAlignment" id="alignment1">
+ <property name="visible">True</property>
+ <property name="top_padding">5</property>
+ <property name="bottom_padding">5</property>
+ <property name="left_padding">10</property>
+ <property name="right_padding">5</property>
+ <child>
+ <object class="GtkHBox" id="hbox1">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkButton" id="home-button">
+ <property name="label" translatable="yes">_All Settings</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="no_show_all">True</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkAlignment" id="entry-alignment">
+ <property name="visible">True</property>
+ <property name="xalign">1</property>
+ <property name="xscale">0</property>
+ <child>
+ <object class="GtkBox" id="topright">
+ <property name="visible">True</property>
+ <property name="orientation">horizontal</property>
+ <child>
+ <object class="GtkEntry" id="search-entry">
+ <property name="width_request">210</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">●</property>
+ <property name="secondary-icon-name">edit-find-symbolic</property>
+ <property name="secondary-icon-activatable">False</property>
+ <property name="secondary-icon-sensitive">False</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLockButton" id="lock-button">
+ <property name="visible">False</property>
+ <property name="no_show_all">True</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkNotebook" id="notebook">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="show_tabs">False</property>
+ <property name="show_border">False</property>
+ <child>
+ <object class="GtkScrolledWindow" id="scrolledwindow1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">never</property>
+ <property name="vscrollbar_policy">automatic</property>
+ <child>
+ <object class="GtkViewport" id="viewport">
+ <property name="visible">True</property>
+ <property name="resize_mode">queue</property>
+ <child>
+ <object class="GtkVBox" id="main-vbox">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child type="tab">
+ <placeholder/>
+ </child>
+ <child>
+ <object class="GtkScrolledWindow" id="search-scrolled-window">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">automatic</property>
+ <property name="vscrollbar_policy">automatic</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child type="tab">
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ <object class="GtkListStore" id="liststore">
+ <columns>
+ <!-- column-name name -->
+ <column type="gchararray"/>
+ <!-- column-name exec -->
+ <column type="gchararray"/>
+ <!-- column-name icon -->
+ <column type="gchararray"/>
+ </columns>
+ </object>
+ <object class="GtkSizeGroup" id="sizegroup">
+ <property name="mode">vertical</property>
+ <widgets>
+ <widget name="home-button"/>
+ <widget name="entry-alignment"/>
+ </widgets>
+ </object>
+</interface>
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r64978 - /tags/branch-Code-11-SP2-2_17_85/packager/
by lslezak@svn2.opensuse.org 25 Jul '11
by lslezak@svn2.opensuse.org 25 Jul '11
25 Jul '11
Author: lslezak
Date: Mon Jul 25 11:21:22 2011
New Revision: 64978
URL: http://svn.opensuse.org/viewcvs/yast?rev=64978&view=rev
Log:
Created tag branch-Code-11-SP2-2_17_85 for packager
Added:
tags/branch-Code-11-SP2-2_17_85/packager/ (props changed)
- copied from r64977, branches/SuSE-Code-11-SP2-Branch/packager/
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r64977 - in /branches/SuSE-Code-11-SP2-Branch/autoinstallation: VERSION package/autoyast2.changes
by ug@svn2.opensuse.org 25 Jul '11
by ug@svn2.opensuse.org 25 Jul '11
25 Jul '11
Author: ug
Date: Mon Jul 25 11:19:03 2011
New Revision: 64977
URL: http://svn.opensuse.org/viewcvs/yast?rev=64977&view=rev
Log:
2.17.47
Modified:
branches/SuSE-Code-11-SP2-Branch/autoinstallation/VERSION
branches/SuSE-Code-11-SP2-Branch/autoinstallation/package/autoyast2.changes
Modified: branches/SuSE-Code-11-SP2-Branch/autoinstallation/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/autoi…
==============================================================================
--- branches/SuSE-Code-11-SP2-Branch/autoinstallation/VERSION (original)
+++ branches/SuSE-Code-11-SP2-Branch/autoinstallation/VERSION Mon Jul 25 11:19:03 2011
@@ -1 +1 @@
-2.17.46
+2.17.47
Modified: branches/SuSE-Code-11-SP2-Branch/autoinstallation/package/autoyast2.changes
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/autoi…
==============================================================================
--- branches/SuSE-Code-11-SP2-Branch/autoinstallation/package/autoyast2.changes (original)
+++ branches/SuSE-Code-11-SP2-Branch/autoinstallation/package/autoyast2.changes Mon Jul 25 11:19:03 2011
@@ -3,6 +3,7 @@
- speed up partition calculation when a lot partitions are
reused (bnc#620212)
+- 2.17.47
-------------------------------------------------------------------
Mon Jul 25 10:06:25 CEST 2011 - ug(a)suse.de
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r64976 - in /branches/SuSE-Code-11-SP2-Branch/packager: VERSION package/yast2-packager.changes src/clients/software_proposal.ycp src/modules/Packages.ycp
by lslezak@svn2.opensuse.org 25 Jul '11
by lslezak@svn2.opensuse.org 25 Jul '11
25 Jul '11
Author: lslezak
Date: Mon Jul 25 11:04:52 2011
New Revision: 64976
URL: http://svn.opensuse.org/viewcvs/yast?rev=64976&view=rev
Log:
- do not skip package proposal when the partitioner has changed
proposed packages - i.e. add snapper packages after switching to
btrfs (bnc#704127)
- 2.17.85
Modified:
branches/SuSE-Code-11-SP2-Branch/packager/VERSION
branches/SuSE-Code-11-SP2-Branch/packager/package/yast2-packager.changes
branches/SuSE-Code-11-SP2-Branch/packager/src/clients/software_proposal.ycp
branches/SuSE-Code-11-SP2-Branch/packager/src/modules/Packages.ycp
Modified: branches/SuSE-Code-11-SP2-Branch/packager/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/packa…
==============================================================================
--- branches/SuSE-Code-11-SP2-Branch/packager/VERSION (original)
+++ branches/SuSE-Code-11-SP2-Branch/packager/VERSION Mon Jul 25 11:04:52 2011
@@ -1 +1 @@
-2.17.84
+2.17.85
Modified: branches/SuSE-Code-11-SP2-Branch/packager/package/yast2-packager.changes
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/packa…
==============================================================================
--- branches/SuSE-Code-11-SP2-Branch/packager/package/yast2-packager.changes (original)
+++ branches/SuSE-Code-11-SP2-Branch/packager/package/yast2-packager.changes Mon Jul 25 11:04:52 2011
@@ -1,4 +1,12 @@
-------------------------------------------------------------------
+Mon Jul 25 08:33:29 UTC 2011 - lslezak(a)suse.cz
+
+- do not skip package proposal when the partitioner has changed
+ proposed packages - i.e. add snapper packages after switching to
+ btrfs (bnc#704127)
+- 2.17.85
+
+-------------------------------------------------------------------
Mon Jun 27 15:45:13 UTC 2011 - lslezak(a)suse.cz
- remove the addon repository after aborting license confirmation
Modified: branches/SuSE-Code-11-SP2-Branch/packager/src/clients/software_proposal.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/packa…
==============================================================================
--- branches/SuSE-Code-11-SP2-Branch/packager/src/clients/software_proposal.ycp (original)
+++ branches/SuSE-Code-11-SP2-Branch/packager/src/clients/software_proposal.ycp Mon Jul 25 11:04:52 2011
@@ -71,7 +71,7 @@
// if only partitioning has been changed just return the current state,
// don't reset to default (bnc#450786, bnc#371875)
- if (partition_changed && !language_changed && !force_reset)
+ if (partition_changed && !language_changed && !force_reset && !Packages::PackagesProposalChanged())
{
return Packages::Summary ([ `product, `pattern, `selection, `size, `desktop ], false);
}
Modified: branches/SuSE-Code-11-SP2-Branch/packager/src/modules/Packages.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/packa…
==============================================================================
--- branches/SuSE-Code-11-SP2-Branch/packager/src/modules/Packages.ycp (original)
+++ branches/SuSE-Code-11-SP2-Branch/packager/src/modules/Packages.ycp Mon Jul 25 11:04:52 2011
@@ -1751,6 +1751,24 @@
any old_packages_proposal = nil;
/**
+ * Check whether the list of needed packages has been changed since the last
+ * package proposal
+ *
+ * @return boolean true if PackagesProposal has been changed
+ */
+global boolean PackagesProposalChanged()
+{
+ any new_packages_proposal = PackagesProposal::GetAllResolvablesForAllTypes();
+
+ // Force reinit
+ boolean changed = new_packages_proposal != old_packages_proposal;
+ y2milestone ("PackagesProposal has been changed: %1", changed);
+ y2debug("PackagesProposal: %1 -> %2", old_packages_proposal, new_packages_proposal);
+
+ return changed;
+}
+
+/**
* Make a proposal for package selection
*
* @param force reset (fully resets the proposal and creates a new one)
@@ -1762,13 +1780,10 @@
// Handle the default desktop
DefaultDesktop::Init();
- // If anything has changed
- any new_packages_proposal = PackagesProposal::GetAllResolvablesForAllTypes();
-
// Force reinit
- if (new_packages_proposal != old_packages_proposal) {
- y2milestone ("PackagesProposal have changed");
- old_packages_proposal = new_packages_proposal;
+ if (PackagesProposalChanged()) {
+ old_packages_proposal = PackagesProposal::GetAllResolvablesForAllTypes();
+ y2milestone("Reinit package proposal");
reinit = true;
}
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r64975 - in /branches/SuSE-Code-11-SP2-Branch/autoinstallation: package/autoyast2.changes src/include/autopart.ycp
by ug@svn2.opensuse.org 25 Jul '11
by ug@svn2.opensuse.org 25 Jul '11
25 Jul '11
Author: ug
Date: Mon Jul 25 10:36:49 2011
New Revision: 64975
URL: http://svn.opensuse.org/viewcvs/yast?rev=64975&view=rev
Log:
speed up partition calculation (bnc#620212)
Modified:
branches/SuSE-Code-11-SP2-Branch/autoinstallation/package/autoyast2.changes
branches/SuSE-Code-11-SP2-Branch/autoinstallation/src/include/autopart.ycp
Modified: branches/SuSE-Code-11-SP2-Branch/autoinstallation/package/autoyast2.changes
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/autoi…
==============================================================================
--- branches/SuSE-Code-11-SP2-Branch/autoinstallation/package/autoyast2.changes (original)
+++ branches/SuSE-Code-11-SP2-Branch/autoinstallation/package/autoyast2.changes Mon Jul 25 10:36:49 2011
@@ -1,4 +1,10 @@
-------------------------------------------------------------------
+Mon Jul 25 10:30:56 CEST 2011 - ug(a)suse.de
+
+- speed up partition calculation when a lot partitions are
+ reused (bnc#620212)
+
+-------------------------------------------------------------------
Mon Jul 25 10:06:25 CEST 2011 - ug(a)suse.de
- notification option for scripts added (fate#312674)
Modified: branches/SuSE-Code-11-SP2-Branch/autoinstallation/src/include/autopart.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/autoi…
==============================================================================
--- branches/SuSE-Code-11-SP2-Branch/autoinstallation/src/include/autopart.ycp (original)
+++ branches/SuSE-Code-11-SP2-Branch/autoinstallation/src/include/autopart.ycp Mon Jul 25 10:36:49 2011
@@ -903,7 +903,16 @@
``{
y2milestone( "start: gap section %1", e );
- if( part["max_cyl"]:0 <= e["end"]:0 &&
+ // speed up partitioning calculation (bnc#620212)
+ boolean reuseCondition = true;
+ if( part["create"]:true == false &&
+ (( haskey( part, "partition_nr" ) && part["partition_nr"]:0 != e["nr"]:0 )) ) {
+ y2milestone("gap can't be used. %1 != %2", part["partition_nr"]:0, e["nr"]:0 );
+ reuseCondition = false;
+ }
+
+ if( reuseCondition &&
+ part["max_cyl"]:0 <= e["end"]:0 &&
part["cylinders"]:0 <= e["cylinders"]:0 &&
(!e["extended"]:false && (size(lg["free_pnr"]:[])>0 || ! creation_needed ) ||
e["extended"]:false && size(lg["ext_pnr"]:[])>0)
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r64974 - in /branches/SuSE-Code-11-SP2-Branch/autoinstallation: package/autoyast2.changes src/modules/AutoinstScripts.ycp
by ug@svn2.opensuse.org 25 Jul '11
by ug@svn2.opensuse.org 25 Jul '11
25 Jul '11
Author: ug
Date: Mon Jul 25 10:07:11 2011
New Revision: 64974
URL: http://svn.opensuse.org/viewcvs/yast?rev=64974&view=rev
Log:
notification option for scripts added (fate#312674)
Modified:
branches/SuSE-Code-11-SP2-Branch/autoinstallation/package/autoyast2.changes
branches/SuSE-Code-11-SP2-Branch/autoinstallation/src/modules/AutoinstScripts.ycp
Modified: branches/SuSE-Code-11-SP2-Branch/autoinstallation/package/autoyast2.changes
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/autoi…
==============================================================================
--- branches/SuSE-Code-11-SP2-Branch/autoinstallation/package/autoyast2.changes (original)
+++ branches/SuSE-Code-11-SP2-Branch/autoinstallation/package/autoyast2.changes Mon Jul 25 10:07:11 2011
@@ -1,4 +1,9 @@
-------------------------------------------------------------------
+Mon Jul 25 10:06:25 CEST 2011 - ug(a)suse.de
+
+- notification option for scripts added (fate#312674)
+
+-------------------------------------------------------------------
Fri Jul 22 09:54:01 CEST 2011 - ug(a)suse.de
- passing a type=boolean to an ask-script via $VAL did not work
Modified: branches/SuSE-Code-11-SP2-Branch/autoinstallation/src/modules/AutoinstScripts.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/autoi…
==============================================================================
--- branches/SuSE-Code-11-SP2-Branch/autoinstallation/src/modules/AutoinstScripts.ycp (original)
+++ branches/SuSE-Code-11-SP2-Branch/autoinstallation/src/modules/AutoinstScripts.ycp Mon Jul 25 10:07:11 2011
@@ -137,6 +137,7 @@
"source":p["source"]:"",
"location":p["location"]:"",
"feedback":p["feedback"]:false,
+ "notification":p["notification"]:"",
"debug":p["debug"]:true
]);
});
@@ -147,6 +148,7 @@
"location":p["location"]:"",
"feedback":p["feedback"]:false,
"debug":p["debug"]:true,
+ "notification":p["notification"]:"",
"network_needed":p["network_needed"]:false
]
);
@@ -158,6 +160,7 @@
"chrooted":p["chrooted"]:false,
"location":p["location"]:"",
"feedback":p["feedback"]:false,
+ "notification":p["notification"]:"",
"debug":p["debug"]:true
]);
});
@@ -317,6 +320,7 @@
string source,
string interpreter,
string type,
+ string notification,
boolean chrooted,
boolean debug,
boolean feedback,
@@ -337,6 +341,7 @@
oldScript=add(oldScript,"debug",debug);
oldScript=add(oldScript,"feedback",feedback);
oldScript=add(oldScript,"network_needed",network);
+ oldScript=add(oldScript,"notification", notification);
mod = true;
return oldScript;
@@ -357,6 +362,7 @@
script=add(script,"debug",debug);
script=add(script,"feedback",feedback);
script=add(script,"network_needed",network);
+ script=add(script,"notification", notification);
merged=add(merged,script);
}
@@ -684,6 +690,9 @@
string executionString = "";
boolean showFeedback = s["feedback"]:false;
+ if( s["notification"]:"" != "" )
+ Popup::ShowFeedback( "", s["notification"]:"" );
+
if (scriptInterpreter == "shell")
{
string debug = ( s["debug"]:true ? "-x" : "" );
@@ -731,6 +740,9 @@
}
string feedback = "";
+ if( s["notification"]:"" != "" )
+ Popup::ClearFeedback();
+
if( executionString != "" ) {
if( showFeedback ) {
feedback = (string)SCR::Read(.target.string, current_logdir+"/"+scriptName+".log" );
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r64973 - /tags/branch-Code-11-SP2-2_17_101/yast2/
by jsuchome@svn2.opensuse.org 25 Jul '11
by jsuchome@svn2.opensuse.org 25 Jul '11
25 Jul '11
Author: jsuchome
Date: Mon Jul 25 09:18:24 2011
New Revision: 64973
URL: http://svn.opensuse.org/viewcvs/yast?rev=64973&view=rev
Log:
Created tag branch-Code-11-SP2-2_17_101 for yast2
Added:
tags/branch-Code-11-SP2-2_17_101/yast2/ (props changed)
- copied from r64972, branches/SuSE-Code-11-SP2-Branch/yast2/
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r64972 - in /branches/SuSE-Code-11-SP2-Branch/yast2: VERSION library/control/src/ProductProfile.ycp package/yast2.changes
by jsuchome@svn2.opensuse.org 25 Jul '11
by jsuchome@svn2.opensuse.org 25 Jul '11
25 Jul '11
Author: jsuchome
Date: Mon Jul 25 09:18:15 2011
New Revision: 64972
URL: http://svn.opensuse.org/viewcvs/yast?rev=64972&view=rev
Log:
- do not use SourceProvideSignedFile for product profile
(bnc#706646)
- 2.17.101
Modified:
branches/SuSE-Code-11-SP2-Branch/yast2/VERSION
branches/SuSE-Code-11-SP2-Branch/yast2/library/control/src/ProductProfile.ycp
branches/SuSE-Code-11-SP2-Branch/yast2/package/yast2.changes
Modified: branches/SuSE-Code-11-SP2-Branch/yast2/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/yast2…
==============================================================================
--- branches/SuSE-Code-11-SP2-Branch/yast2/VERSION (original)
+++ branches/SuSE-Code-11-SP2-Branch/yast2/VERSION Mon Jul 25 09:18:15 2011
@@ -1 +1 @@
-2.17.100
+2.17.101
Modified: branches/SuSE-Code-11-SP2-Branch/yast2/library/control/src/ProductProfile.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/yast2…
==============================================================================
--- branches/SuSE-Code-11-SP2-Branch/yast2/library/control/src/ProductProfile.ycp (original)
+++ branches/SuSE-Code-11-SP2-Branch/yast2/library/control/src/ProductProfile.ycp Mon Jul 25 09:18:15 2011
@@ -92,7 +92,7 @@
compliance_checked[src_id] = true;
- string profile = Pkg::SourceProvideSignedFile (src_id, 1, profile_path, true);
+ string profile = Pkg::SourceProvideOptionalFile (src_id, 1, profile_path);
if (profile != nil)
{
profiles = add (profiles, profile);
Modified: branches/SuSE-Code-11-SP2-Branch/yast2/package/yast2.changes
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/yast2…
==============================================================================
--- branches/SuSE-Code-11-SP2-Branch/yast2/package/yast2.changes (original)
+++ branches/SuSE-Code-11-SP2-Branch/yast2/package/yast2.changes Mon Jul 25 09:18:15 2011
@@ -1,4 +1,11 @@
-------------------------------------------------------------------
+Fri Jul 22 16:09:08 CEST 2011 - jsuchome(a)suse.cz
+
+- do not use SourceProvideSignedFile for product profile
+ (bnc#706646)
+- 2.17.101
+
+-------------------------------------------------------------------
Fri Jun 24 09:15:27 CEST 2011 - jsuchome(a)suse.cz
- show different popup when adding add-on,
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r64971 - in /trunk/gtk/src: pkg/ygtkcellrenderersidebutton.c pkg/ygtkpkgdetailview.cc ygtkimage.c
by rpmcruz@svn2.opensuse.org 24 Jul '11
by rpmcruz@svn2.opensuse.org 24 Jul '11
24 Jul '11
Author: rpmcruz
Date: Sun Jul 24 04:03:33 2011
New Revision: 64971
URL: http://svn.opensuse.org/viewcvs/yast?rev=64971&view=rev
Log:
bug fix: gray out disabled images.
bug fix: layout issues with the Dependencies table on sw_single.
Modified:
trunk/gtk/src/pkg/ygtkcellrenderersidebutton.c
trunk/gtk/src/pkg/ygtkpkgdetailview.cc
trunk/gtk/src/ygtkimage.c
Modified: trunk/gtk/src/pkg/ygtkcellrenderersidebutton.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkcellrendererside…
==============================================================================
--- trunk/gtk/src/pkg/ygtkcellrenderersidebutton.c (original)
+++ trunk/gtk/src/pkg/ygtkcellrenderersidebutton.c Sun Jul 24 04:03:33 2011
@@ -19,6 +19,8 @@
G_DEFINE_TYPE (YGtkCellRendererSideButton, ygtk_cell_renderer_side_button, GTK_TYPE_CELL_RENDERER_TEXT)
+#define DEPRESS_PAD 1
+
static void ygtk_cell_renderer_side_button_init (YGtkCellRendererSideButton *bcell)
{ g_object_set(GTK_CELL_RENDERER(bcell), "mode", GTK_CELL_RENDERER_MODE_ACTIVATABLE, NULL); }
@@ -156,8 +158,7 @@
icon_area.x += 2;
icon_area.y += 2;
if (bcell->active) {
- icon_area.x += 2;
- icon_area.y += 2;
+ icon_area.x += DEPRESS_PAD; icon_area.y += DEPRESS_PAD;
}
ensure_pixbuf (bcell, widget);
Modified: trunk/gtk/src/pkg/ygtkpkgdetailview.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpkgdetailview.cc…
==============================================================================
--- trunk/gtk/src/pkg/ygtkpkgdetailview.cc (original)
+++ trunk/gtk/src/pkg/ygtkpkgdetailview.cc Sun Jul 24 04:03:33 2011
@@ -647,17 +647,21 @@
virtual void setList (Ypp::List list)
{
if (list.size() == 1) {
- gtk_widget_show (expander);
-
Ypp::Selectable sel = list.get (0);
Ypp::Package pkg (sel);
+ int support = pkg.support();
+
std::string label ("<b>" + std::string (_("Supportability:")) + "</b> ");
- label += Ypp::Package::supportSummary (pkg.support());
+ label += Ypp::Package::supportSummary (support);
gtk_expander_set_label (GTK_EXPANDER (expander), label.c_str());
-
ygtk_rich_text_set_text (YGTK_RICH_TEXT (text),
- Ypp::Package::supportDescription (pkg.support()).c_str());
+ Ypp::Package::supportDescription (support).c_str());
+
+ if (support == 0)
+ gtk_widget_hide(expander);
+ else
+ gtk_widget_show (expander);
}
else
gtk_widget_hide (expander);
@@ -665,20 +669,22 @@
};
struct DependenciesExpander : public DetailExpander {
- GtkWidget *vbox;
+ GtkWidget *grid;
DependenciesExpander()
: DetailExpander (_("Dependencies"), false)
{
- vbox = gtk_vbox_new (FALSE, 6);
- setChild (vbox);
+ grid = gtk_grid_new();
+ gtk_widget_set_hexpand (grid, TRUE);
+ gtk_widget_set_vexpand (grid, FALSE);
+ setChild (grid);
}
void clear()
{
- GList *children = gtk_container_get_children (GTK_CONTAINER (vbox));
+ GList *children = gtk_container_get_children (GTK_CONTAINER (grid));
for (GList *i = children; i; i = i->next)
- gtk_container_remove (GTK_CONTAINER (vbox), (GtkWidget *) i->data);
+ gtk_container_remove (GTK_CONTAINER (grid), (GtkWidget *) i->data);
g_list_free (children);
}
@@ -688,37 +694,31 @@
// if (dep >= 0)
// gtk_box_pack_start (GTK_BOX (vbox), gtk_hseparator_new(), FALSE, TRUE, 0);
- GtkWidget *hbox = gtk_hbox_new (FALSE, 6);
- GtkWidget *col;
- col = ygtk_rich_text_new();
- gtk_widget_set_size_request (col, 100, -1);
- ygtk_rich_text_set_text (YGTK_RICH_TEXT (col),
- ("<i>" + col1 + "</i>").c_str());
- gtk_box_pack_start (GTK_BOX (hbox), col, FALSE, TRUE, 0);
- // by settings both the two following "col" text widgets with the same
- // fixed width, and expanded=True, we ensure all rows have the same size
- col = ygtk_rich_text_new();
- gtk_widget_set_size_request (col, 80, -1);
- ygtk_rich_text_set_text (YGTK_RICH_TEXT (col), col2.c_str());
- if (dep == 0)
- g_signal_connect (G_OBJECT (col), "link-clicked",
- G_CALLBACK (requires_link_cb), NULL);
- else if (dep == 2)
- g_signal_connect (G_OBJECT (col), "link-clicked",
- G_CALLBACK (provides_link_cb), NULL);
- gtk_box_pack_start (GTK_BOX (hbox), col, TRUE, TRUE, 0);
- col = ygtk_rich_text_new();
- gtk_widget_set_size_request (col, 80, -1);
- ygtk_rich_text_set_text (YGTK_RICH_TEXT (col), col3.c_str());
- if (dep == 0)
- g_signal_connect (G_OBJECT (col), "link-clicked",
- G_CALLBACK (requires_link_cb), NULL);
- else if (dep == 2)
- g_signal_connect (G_OBJECT (col), "link-clicked",
- G_CALLBACK (provides_link_cb), NULL);
- gtk_box_pack_start (GTK_BOX (hbox), col, TRUE, TRUE, 0);
+ GtkWidget *cols[3];
+ for(int i = 0; i < 3; i++) {
+ cols[i] = ygtk_rich_text_new();
+ gtk_widget_set_size_request(cols[i], 100, -1);
+ }
+
+ ygtk_rich_text_set_text (YGTK_RICH_TEXT (cols[0]), ("<i>" + col1 + "</i>").c_str());
+ ygtk_rich_text_set_text (YGTK_RICH_TEXT (cols[1]), col2.c_str());
+ ygtk_rich_text_set_text (YGTK_RICH_TEXT (cols[2]), col3.c_str());
+
+ for(int i = 1; i < 3; i++) {
+ if (dep == 0)
+ g_signal_connect (G_OBJECT (cols[i]), "link-clicked",
+ G_CALLBACK (requires_link_cb), NULL);
+ else if (dep == 2)
+ g_signal_connect (G_OBJECT (cols[i]), "link-clicked",
+ G_CALLBACK (provides_link_cb), NULL);
+ }
+
+ GList *children = gtk_container_get_children(GTK_CONTAINER(grid));
+ guint top = g_list_length (children) / 3;
+ g_list_free (children);
- gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
+ for(int i = 0; i < 3; i++)
+ gtk_grid_attach (GTK_GRID (grid), cols[i], i, top, 1, 1);
}
static void requires_link_cb (GtkWidget *widget, const gchar *link)
@@ -754,7 +754,7 @@
if (!inst.empty() || !cand.empty())
addLine (VersionDependencies::getLabel (dep), inst, cand, dep);
}
- gtk_widget_show_all (vbox);
+ gtk_widget_show_all (grid);
}
virtual void showRefreshList (Ypp::List list)
Modified: trunk/gtk/src/ygtkimage.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkimage.c?rev=64971&r1…
==============================================================================
--- trunk/gtk/src/ygtkimage.c (original)
+++ trunk/gtk/src/ygtkimage.c Sun Jul 24 04:03:33 2011
@@ -211,14 +211,19 @@
}
static GdkPixbuf *ygtk_image_render_state (GtkWidget *widget, GdkPixbuf *pixbuf)
-{
- // as in GtkImage
+{ // as in GtkImage
GtkIconSource *source = gtk_icon_source_new();
+ GtkStyleContext *style = gtk_widget_get_style_context (widget);
+ gtk_style_context_save (style);
+ gtk_style_context_set_state (style, gtk_widget_get_state_flags (widget));
+
GdkPixbuf *rendered;
gtk_icon_source_set_pixbuf (source, pixbuf);
gtk_icon_source_set_size (source, GTK_ICON_SIZE_SMALL_TOOLBAR);
gtk_icon_source_set_size_wildcarded (source, FALSE);
- rendered = gtk_render_icon_pixbuf (gtk_widget_get_style_context(widget), source, (GtkIconSize)-1);
+ rendered = gtk_render_icon_pixbuf (style, source, (GtkIconSize)-1);
+
+ gtk_style_context_restore (style);
gtk_icon_source_free (source);
return rendered;
}
@@ -256,7 +261,7 @@
else
pixbuf = image->pixbuf;
- gboolean needs_transform = gtk_widget_get_state (widget) != GTK_STATE_NORMAL;
+ gboolean needs_transform = gtk_widget_get_state_flags (widget) & GTK_STATE_FLAG_INSENSITIVE;
if (needs_transform)
pixbuf = ygtk_image_render_state (widget, pixbuf);
int x = 0, y = 0;
@@ -292,6 +297,12 @@
return FALSE;
}
+static void ygtk_image_state_flags_changed (GtkWidget *widget, GtkStateFlags old_flags)
+{
+ // it seems like we need to force a redraw in gtk3 when state changes
+ gtk_widget_queue_draw (widget);
+}
+
GtkWidget* ygtk_image_new (void)
{
return g_object_new (YGTK_TYPE_IMAGE, NULL);
@@ -304,5 +315,6 @@
widget_class->get_preferred_width = ygtk_image_get_preferred_width;
widget_class->get_preferred_height = ygtk_image_get_preferred_height;
widget_class->destroy = ygtk_image_destroy;
+ widget_class->state_flags_changed = ygtk_image_state_flags_changed;
}
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r64970 - in /trunk/gtk/src/pkg: pkg-selector-help.cc ygtkpkgmenubar.cc
by rpmcruz@svn2.opensuse.org 23 Jul '11
by rpmcruz@svn2.opensuse.org 23 Jul '11
23 Jul '11
Author: rpmcruz
Date: Sat Jul 23 07:59:06 2011
New Revision: 64970
URL: http://svn.opensuse.org/viewcvs/yast?rev=64970&view=rev
Log:
Fixed a couple of typos (bnc#703105)
Modified:
trunk/gtk/src/pkg/pkg-selector-help.cc
trunk/gtk/src/pkg/ygtkpkgmenubar.cc
Modified: trunk/gtk/src/pkg/pkg-selector-help.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/pkg-selector-help.cc…
==============================================================================
--- trunk/gtk/src/pkg/pkg-selector-help.cc (original)
+++ trunk/gtk/src/pkg/pkg-selector-help.cc Sat Jul 23 07:59:06 2011
@@ -16,7 +16,7 @@
"if needed. The user need not be concerned about such underlying <i>dependencies</i>. "
"Likewise, the plugins and other non-essential data of a given application may "
"be shipped in their own packages, so the user may install them only if needed.</p>"),
- _("<p>Common suffixes for complementory packages:</p>"
+ _("<p>Common suffixes for complementary packages:</p>"
"<ul>"
"<li><b>-plugin-</b>: extends the application with extra functionality.</li>"
"<li><b>-devel</b>: headers for software development.</li>"
Modified: trunk/gtk/src/pkg/ygtkpkgmenubar.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpkgmenubar.cc?re…
==============================================================================
--- trunk/gtk/src/pkg/ygtkpkgmenubar.cc (original)
+++ trunk/gtk/src/pkg/ygtkpkgmenubar.cc Sat Jul 23 07:59:06 2011
@@ -749,7 +749,7 @@
append_menu_item (submenu, _("Install All Matching -&devel Packages"), NULL,
G_CALLBACK (install_all_devel_pkgs_cb), this);
// Translators: keep "-debug-_info" untranslated
- append_menu_item (submenu, _("Install All Matching -debug-&sinfo Packages"), NULL,
+ append_menu_item (submenu, _("Install All Matching -debug-&info Packages"), NULL,
G_CALLBACK (install_all_debug_info_pkgs_cb), this);
// Translators: keep "-debug-_source" untranslated
append_menu_item (submenu, _("Install All Matching -debug-&source Packages"), NULL,
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r64969 - in /trunk/gtk: ./ cmake/ cmake/modules/ package/ src/ src/pkg/
by rpmcruz@svn2.opensuse.org 23 Jul '11
by rpmcruz@svn2.opensuse.org 23 Jul '11
23 Jul '11
Author: rpmcruz
Date: Sat Jul 23 07:43:30 2011
New Revision: 64969
URL: http://svn.opensuse.org/viewcvs/yast?rev=64969&view=rev
Log:
- ported to gtk3 (initial work by Duncan)
- don't show unsupported packages when the list is empty
(bnc#704103).
- showing mnemonics characters (bnc#704102).
Added:
trunk/gtk/cmake/
trunk/gtk/cmake/modules/
trunk/gtk/cmake/modules/FindGTK3.cmake
Modified:
trunk/gtk/CMakeLists.txt
trunk/gtk/package/yast2-gtk.changes
trunk/gtk/src/CMakeLists.txt
trunk/gtk/src/YGBarGraph.cc
trunk/gtk/src/YGComboBox.cc
trunk/gtk/src/YGDialog.cc
trunk/gtk/src/YGDumbTab.cc
trunk/gtk/src/YGFrame.cc
trunk/gtk/src/YGImage.cc
trunk/gtk/src/YGLayout.cc
trunk/gtk/src/YGProgressBar.cc
trunk/gtk/src/YGPushButton.cc
trunk/gtk/src/YGSelectionStore.h
trunk/gtk/src/YGText.cc
trunk/gtk/src/YGTreeView.cc
trunk/gtk/src/YGUI.cc
trunk/gtk/src/YGUI.h
trunk/gtk/src/YGUtils.cc
trunk/gtk/src/YGUtils.h
trunk/gtk/src/YGWidget.cc
trunk/gtk/src/pkg/CMakeLists.txt
trunk/gtk/src/pkg/YGPackageSelector.cc
trunk/gtk/src/pkg/ygtkcellrendererbutton.c
trunk/gtk/src/pkg/ygtkcellrendererbutton.h
trunk/gtk/src/pkg/ygtkcellrenderersidebutton.c
trunk/gtk/src/pkg/ygtkcellrenderersidebutton.h
trunk/gtk/src/pkg/ygtkcellrenderertext.c
trunk/gtk/src/pkg/ygtkcellrenderertext.h
trunk/gtk/src/pkg/ygtkpkgdetailview.cc
trunk/gtk/src/pkg/ygtkpkgdetailview.h
trunk/gtk/src/pkg/ygtkpkgfilterview.h
trunk/gtk/src/pkg/ygtkpkghistorydialog.cc
trunk/gtk/src/pkg/ygtkpkghistorydialog.h
trunk/gtk/src/pkg/ygtkpkglistview.cc
trunk/gtk/src/pkg/ygtkpkglistview.h
trunk/gtk/src/pkg/ygtkpkgmenubar.cc
trunk/gtk/src/pkg/ygtkpkgmenubar.h
trunk/gtk/src/pkg/ygtkpkgpatternview.h
trunk/gtk/src/pkg/ygtkpkgproductdialog.cc
trunk/gtk/src/pkg/ygtkpkgproductdialog.h
trunk/gtk/src/pkg/ygtkpkgquerycombo.cc
trunk/gtk/src/pkg/ygtkpkgquerycombo.h
trunk/gtk/src/pkg/ygtkpkgquerywidget.h
trunk/gtk/src/pkg/ygtkpkgrpmgroupsview.h
trunk/gtk/src/pkg/ygtkpkgsearchentry.cc
trunk/gtk/src/pkg/ygtkpkgstatusbar.cc
trunk/gtk/src/pkg/ygtkpkgstatusbar.h
trunk/gtk/src/pkg/ygtkpkgundolist.cc
trunk/gtk/src/pkg/ygtkpkgvestigialdialog.h
trunk/gtk/src/pkg/ygtktreemodel.h
trunk/gtk/src/ygdkmngloader.c
trunk/gtk/src/ygtkbargraph.c
trunk/gtk/src/ygtkbargraph.h
trunk/gtk/src/ygtkfieldentry.c
trunk/gtk/src/ygtkfieldentry.h
trunk/gtk/src/ygtkfixed.c
trunk/gtk/src/ygtkfixed.h
trunk/gtk/src/ygtkhtmlwrap.c
trunk/gtk/src/ygtkhtmlwrap.h
trunk/gtk/src/ygtkimage.c
trunk/gtk/src/ygtkimage.h
trunk/gtk/src/ygtklinklabel.c
trunk/gtk/src/ygtklinklabel.h
trunk/gtk/src/ygtkmenubutton.c
trunk/gtk/src/ygtkmenubutton.h
trunk/gtk/src/ygtkratiobox.c
trunk/gtk/src/ygtkratiobox.h
trunk/gtk/src/ygtkrichtext.c
trunk/gtk/src/ygtksteps.c
trunk/gtk/src/ygtksteps.h
trunk/gtk/src/ygtktextview.h
trunk/gtk/src/ygtktimezonepicker.c
trunk/gtk/src/ygtktimezonepicker.h
trunk/gtk/src/ygtktreeview.c
trunk/gtk/src/ygtktreeview.h
trunk/gtk/src/ygtkwizard.c
trunk/gtk/src/ygtkwizard.h
Modified: trunk/gtk/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/CMakeLists.txt?rev=64969&r1=…
==============================================================================
--- trunk/gtk/CMakeLists.txt (original)
+++ trunk/gtk/CMakeLists.txt Sat Jul 23 07:43:30 2011
@@ -2,16 +2,16 @@
cmake_minimum_required (VERSION 2.4)
project (yast2-gtk)
-
+SET( CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules )
## configure
-find_package (GTK2 REQUIRED gtk)
+find_package (GTK3 REQUIRED gtk)
find_package (Libyui REQUIRED)
find_package (Zypp REQUIRED)
-# debug while GTK2 support is shaky
-message (STATUS "GTK2 includes:" ${GTK2_INCLUDE_DIRS})
-message (STATUS "GTK2 libraries:" ${GTK2_LIBRARIES})
+# ricardo: debug gtk cmake
+message (STATUS "GTK3 includes:" ${GTK3_INCLUDE_DIRS})
+message (STATUS "GTK3 libraries:" ${GTK3_LIBRARIES})
# set libyui and libzypp versions
execute_process (COMMAND pkg-config --modversion yast2-libyui COMMAND awk -F. "{ printf \"%d\", ($1 * 1000 + $2) * 1000 + $3;}" OUTPUT_VARIABLE YAST2_VERSION)
Added: trunk/gtk/cmake/modules/FindGTK3.cmake
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/cmake/modules/FindGTK3.cmake…
==============================================================================
--- trunk/gtk/cmake/modules/FindGTK3.cmake (added)
+++ trunk/gtk/cmake/modules/FindGTK3.cmake Sat Jul 23 07:43:30 2011
@@ -0,0 +1,47 @@
+# - Try to find GTK3
+# Once done this will define
+#
+# GTK3_FOUND - System has GTK3
+# GTK3_INCLUDE_DIR - The GTK3 include directory
+# GTK3_LIBRARIES - The libraries needed to use GTK3
+# GTK3_DEFINITIONS - Compiler switches required for using GTK3
+#=============================================================================
+# Copyright 2011 Duncan Mac-Vicar P. <duncan(a)kde.org>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+# use pkg-config to get the directories and then use these values
+# in the FIND_PATH() and FIND_LIBRARY() calls
+FIND_PACKAGE(PkgConfig)
+PKG_CHECK_MODULES(PC_GTK3 gtk+-3.0 QUIET)
+SET(GTK3_DEFINITIONS ${PC_GTK3_CFLAGS_OTHER})
+
+FIND_PATH(GTK3_INCLUDE_DIR NAMES "gtk/gtk.h"
+ HINTS
+ ${PC_GTK3_INCLUDEDIR}
+ ${PC_GTK3_INCLUDE_DIRS}
+ PATH_SUFFIXES "gtk-3.0"
+ )
+SET(GTK3_INCLUDE_DIRS ${PC_GTK3_INCLUDE_DIRS})
+
+FIND_LIBRARY(GTK3_LIBRARIES NAMES gtk-3 gtk3
+ HINTS
+ ${PC_GTK3_LIBDIR}
+ ${PC_GTK3_LIBRARY_DIRS}
+ )
+
+# handle the QUIETLY and REQUIRED arguments and set GTK3_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTK3 DEFAULT_MSG GTK3_LIBRARIES GTK3_INCLUDE_DIR)
+
+MARK_AS_ADVANCED(GTK3_INCLUDE_DIR GTK3_LIBRARIES)
+
Modified: trunk/gtk/package/yast2-gtk.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/package/yast2-gtk.changes?re…
==============================================================================
--- trunk/gtk/package/yast2-gtk.changes (original)
+++ trunk/gtk/package/yast2-gtk.changes Sat Jul 23 07:43:30 2011
@@ -1,4 +1,13 @@
-------------------------------------------------------------------
+Sat Jul 23 06:35:00 WET 2011 - rpmcruz(a)alunos.dcc.fc.up.pt
+
+- 2.22.0
+- ported to gtk3
+- don't show unsupported packages when the list is empty
+(bnc#704103).
+- showing mnemonics characters (bnc#704102).
+
+-------------------------------------------------------------------
Sat Apr 16 13:51:00 WET 2011 - rpmcruz(a)alunos.dcc.fc.up.pt
- 2.21.96
Modified: trunk/gtk/src/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/CMakeLists.txt?rev=64969…
==============================================================================
--- trunk/gtk/src/CMakeLists.txt (original)
+++ trunk/gtk/src/CMakeLists.txt Sat Jul 23 07:43:30 2011
@@ -1,5 +1,9 @@
## Makefile.am
+add_definitions()
+
+include_directories(${GTK3_INCLUDE_DIRS})
+
set (gtk_yast_plugin_SRCS
YGBarGraph.cc
YGComboBox.cc
@@ -43,7 +47,7 @@
## includes:
include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
-include_directories (${GTK2_INCLUDE_DIRS})
+include_directories (${GTK3_INCLUDE_DIRS})
include_directories (${LIBYUI_INCLUDE_DIR})
## target:
@@ -52,10 +56,10 @@
## libraries:
-target_link_libraries (py2gtk ${GTK2_LIBRARIES})
+target_link_libraries (py2gtk ${GTK3_LIBRARIES})
target_link_libraries (py2gtk ${LIBYUI_LIBRARY})
set_target_properties (py2gtk PROPERTIES SOVERSION 2)
-set_target_properties (py2gtk PROPERTIES LINK_FLAGS "--no-undefined")
+#set_target_properties (py2gtk PROPERTIES LINK_FLAGS "--no-undefined")
## install:
@@ -69,6 +73,6 @@
add_executable (test test.cc)
add_dependencies (test py2gtk)
target_link_libraries (test libpy2gtk.so)
-target_link_libraries (test ${GTK2_LIBRARIES})
+target_link_libraries (test ${GTK3_LIBRARIES})
target_link_libraries (test ${LIBYUI_LIBRARY})
Modified: trunk/gtk/src/YGBarGraph.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGBarGraph.cc?rev=64969&…
==============================================================================
--- trunk/gtk/src/YGBarGraph.cc (original)
+++ trunk/gtk/src/YGBarGraph.cc Sat Jul 23 07:43:30 2011
@@ -26,19 +26,19 @@
const YBarGraphSegment &s = segment (i);
ygtk_bar_graph_setup_entry (graph, i, s.label().c_str(), s.value());
if (s.hasSegmentColor()) {
- GdkColor color = ycolorToGdk (s.segmentColor());
+ GdkRGBA color = ycolorToGdk (s.segmentColor());
ygtk_bar_graph_customize_bg (graph, i, &color);
}
if (s.hasTextColor()) {
- GdkColor color = ycolorToGdk (s.textColor());
+ GdkRGBA color = ycolorToGdk (s.textColor());
ygtk_bar_graph_customize_fg (graph, i, &color);
}
}
}
- static GdkColor ycolorToGdk (const YColor &ycolor)
+ static GdkRGBA ycolorToGdk (const YColor &ycolor)
{
- GdkColor color = { 0, guint16(ycolor.red() << 8), guint16(ycolor.green() << 8), guint16(ycolor.blue() << 8) };
+ GdkRGBA color = { 0, guint16(ycolor.red() << 8), guint16(ycolor.green() << 8), guint16(ycolor.blue() << 8) };
return color;
}
Modified: trunk/gtk/src/YGComboBox.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGComboBox.cc?rev=64969&…
==============================================================================
--- trunk/gtk/src/YGComboBox.cc (original)
+++ trunk/gtk/src/YGComboBox.cc Sat Jul 23 07:43:30 2011
@@ -16,7 +16,7 @@
YGComboBox (YWidget *parent, const string &label, bool editable)
: YComboBox (NULL, label, editable),
YGLabeledWidget (this, parent, label, YD_HORIZ,
- editable ? GTK_TYPE_COMBO_BOX_ENTRY : GTK_TYPE_COMBO_BOX, NULL),
+ GTK_TYPE_COMBO_BOX, "has-entry", editable ? TRUE : FALSE, NULL),
YGSelectionStore (false)
{
const GType types[2] = { GDK_TYPE_PIXBUF, G_TYPE_STRING };
@@ -29,7 +29,7 @@
"pixbuf", 0, NULL);
if (editable)
- gtk_combo_box_entry_set_text_column (GTK_COMBO_BOX_ENTRY (getWidget()), 1);
+ gtk_combo_box_set_entry_text_column (GTK_COMBO_BOX (getWidget()), 1);
else {
cell = gtk_cell_renderer_text_new();
gtk_cell_layout_pack_end (GTK_CELL_LAYOUT (getWidget()), cell, TRUE);
@@ -87,16 +87,18 @@
virtual std::string text()
{
+ GtkTreeIter iter;
gchar *str;
- if (GTK_IS_COMBO_BOX_ENTRY (getWidget()))
- str = gtk_combo_box_get_active_text (getComboBox());
- else {
- GtkTreeIter iter;
- if (gtk_combo_box_get_active_iter (getComboBox(), &iter))
- gtk_tree_model_get (getModel(), &iter, 1, &str, -1);
- else
- return "";
+ if (editable()) {
+ // HACK: this seems to be necessary
+ GtkWidget *entry = gtk_bin_get_child (GTK_BIN (getWidget()));
+ return gtk_entry_get_text (GTK_ENTRY (entry));
}
+ else
+ if (gtk_combo_box_get_active_iter (getComboBox(), &iter))
+ gtk_tree_model_get (getModel(), &iter, 1, &str, -1);
+ else
+ return "";
std::string ret (str);
g_free (str);
return ret;
Modified: trunk/gtk/src/YGDialog.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGDialog.cc?rev=64969&r1…
==============================================================================
--- trunk/gtk/src/YGDialog.cc (original)
+++ trunk/gtk/src/YGDialog.cc Sat Jul 23 07:43:30 2011
@@ -52,6 +52,7 @@
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);
+ gtk_window_set_has_resize_grip (GTK_WINDOW (m_widget), TRUE);
m_refcount = 0;
m_child = NULL;
@@ -140,7 +141,7 @@
{
setChild (NULL);
if (m_busyCursor)
- gdk_cursor_unref (m_busyCursor);
+ g_object_unref (G_OBJECT (m_busyCursor));
gtk_widget_destroy (m_widget);
g_object_unref (G_OBJECT (m_widget));
}
@@ -151,7 +152,7 @@
void normalCursor()
{
if (m_isBusy)
- gdk_window_set_cursor (m_widget->window, NULL);
+ gdk_window_set_cursor (gtk_widget_get_window(m_widget), NULL);
m_isBusy = false;
}
@@ -160,10 +161,10 @@
if (!m_busyCursor) {
GdkDisplay *display = gtk_widget_get_display (m_widget);
m_busyCursor = gdk_cursor_new_for_display (display, GDK_WATCH);
- gdk_cursor_ref (m_busyCursor);
+ g_object_ref (G_OBJECT (m_busyCursor));
}
if (!m_isBusy)
- gdk_window_set_cursor (m_widget->window, m_busyCursor);
+ gdk_window_set_cursor (gtk_widget_get_window(m_widget), m_busyCursor);
m_isBusy = true;
}
@@ -218,16 +219,16 @@
YGWindow *pThis)
{
// if not main dialog, close it on escape
- if (event->keyval == GDK_Escape &&
+ if (event->keyval == GDK_KEY_Escape &&
/* not main window */ main_window != pThis) {
pThis->close();
return TRUE;
-
+
}
if (event->state & GDK_SHIFT_MASK) {
switch (event->keyval) {
- case GDK_F8:
+ case GDK_KEY_F8:
YGUI::ui()->askSaveLogs();
return TRUE;
default:
@@ -238,35 +239,23 @@
&& (event->state & GDK_MOD1_MASK)) {
yuiMilestone() << "Caught YaST2 magic key combination\n";
switch (event->keyval) {
- case GDK_S:
+ case GDK_KEY_S:
YGUI::ui()->makeScreenShot();
return TRUE;
- case GDK_M:
+ case GDK_KEY_M:
YGUI::ui()->toggleRecordMacro();
return TRUE;
- case GDK_P:
+ case GDK_KEY_P:
YGUI::ui()->askPlayMacro();
return TRUE;
- case GDK_D:
+ case GDK_KEY_D:
YGUI::ui()->sendEvent (new YDebugEvent());
return TRUE;
- case GDK_X:
+ case GDK_KEY_X:
yuiMilestone() << "Starting xterm\n";
(void) system ("/usr/bin/xterm &");
return TRUE;
- case GDK_H:
- dumpYastHtml (pThis->getChild());
- return TRUE;
- case GDK_E: // easter egg
- static guint explode_timeout = 0;
- if (explode_timeout == 0)
- explode_timeout = g_timeout_add (10000, expode_window_timeout_cb, pThis);
- else {
- g_source_remove (explode_timeout);
- explode_timeout = 0;
- }
- return TRUE;
- case GDK_Y:
+ case GDK_KEY_Y:
yuiMilestone() << "Opening dialog spy" << endl;
YDialogSpy::showDialogSpy();
YGUI::ui()->normalCursor();
@@ -283,36 +272,6 @@
static void realize_cb (GtkWidget *widget, YGWindow *pThis)
{ pThis->busyCursor(); }
-
- static gboolean expode_window_timeout_cb (gpointer data)
- {
- YGWindow *pThis = (YGWindow *) data;
- GtkWindow *window = GTK_WINDOW (pThis->m_widget);
- srand (time (NULL));
- gint x, y;
- gtk_window_get_position (window, &x, &y);
- #if 0
- // OVAL MOVE
- for (int i = 180; i < 360+180; i++) {
- gtk_window_move (window, x+(int)(sin((i*G_PI)/180)*50),
- y+(int)(cos((i*G_PI)/180)*50)+50);
- while (gtk_events_pending())
- gtk_main_iteration();
- usleep (25);
- }
- #else
- // EXPLOSION
- for (int i = 0; i < 40; i++) {
- gtk_window_move (window, x+(int)((((float)(rand())/RAND_MAX)*40)-20),
- y+(int)((((float)(rand())/RAND_MAX)*40)-20));
- while (gtk_events_pending())
- gtk_main_iteration();
- usleep (200);
- }
- #endif
- gtk_window_move (window, x, y);
- return TRUE;
- }
};
YGDialog::YGDialog (YDialogType dialogType, YDialogColorMode colorMode)
@@ -416,17 +375,19 @@
// libyui calls YDialog::setSize() to force a geometry recalculation as a
// result of changed layout properties
GtkWidget *window = m_window->getWidget();
- if (GTK_WIDGET_REALIZED (window)) {
+ if (gtk_widget_get_realized (window)) {
gtk_widget_queue_resize (window);
width = MIN (width, YUI::app()->displayWidth());
height = MIN (height, YUI::app()->displayHeight());
#if 1
bool resize = false;
if (isMainDialog()) {
- if (window->allocation.width < width || window->allocation.height < height) {
+ GtkAllocation allocation;
+ gtk_widget_get_allocation(window, &allocation);
+ if (allocation.width < width || allocation.height < height) {
resize = true;
- width = MAX (width, window->allocation.width),
- height = MAX (height, window->allocation.height);
+ width = MAX (width, allocation.width),
+ height = MAX (height, allocation.height);
}
}
else
@@ -442,26 +403,23 @@
void YGDialog::highlight (YWidget *ywidget)
{
struct inner {
- static gboolean expose_highlight_cb (GtkWidget *widget,
- GdkEventExpose *event)
+ static gboolean draw_highlight_cb (GtkWidget *widget, cairo_t *cr)
{
- GtkAllocation *alloc = &widget->allocation;
- int x = alloc->x, y = alloc->y, w = alloc->width, h = alloc->height;
+ int w = gtk_widget_get_allocated_width(widget);
+ int h = gtk_widget_get_allocated_height(widget);
- cairo_t *cr = gdk_cairo_create (widget->window);
- cairo_rectangle (cr, x, y, w, h);
+ cairo_rectangle (cr, 0, 0, w, h);
cairo_set_source_rgb (cr, 0xff/255.0, 0x88/255.0, 0);
cairo_fill (cr);
- cairo_destroy (cr);
return FALSE;
}
static bool hasWindow (GtkWidget *widget)
{
- if (!GTK_WIDGET_NO_WINDOW (widget))
+ if (gtk_widget_get_has_window(widget))
return true;
// widgets like GtkButton add their windows to parent's
- for (GList *children = gdk_window_peek_children (widget->window);
+ for (GList *children = gdk_window_peek_children (gtk_widget_get_window(widget));
children; children = children->next) {
GdkWindow *child = (GdkWindow *) children->data;
gpointer data;
@@ -479,12 +437,12 @@
if (prev) {
GtkWidget *widget = prev->getWidget();
if (inner::hasWindow (widget)) {
- gtk_widget_modify_bg (widget, GTK_STATE_NORMAL, NULL);
- gtk_widget_modify_base (widget, GTK_STATE_NORMAL, NULL);
+ gtk_widget_override_background_color (widget, GTK_STATE_FLAG_NORMAL, NULL);
+ gtk_widget_override_color (widget, GTK_STATE_FLAG_NORMAL, NULL);
}
else {
g_signal_handlers_disconnect_by_func (widget,
- (gpointer) inner::expose_highlight_cb, NULL);
+ (gpointer) inner::draw_highlight_cb, NULL);
gtk_widget_queue_draw (widget);
}
}
@@ -494,14 +452,14 @@
if (ygwidget) {
GtkWidget *widget = ygwidget->getWidget();
if (inner::hasWindow (widget)) {
- GdkColor bg_color = { 0, 0xffff, 0xaaaa, 0 };
- GdkColor base_color = { 0, 0xffff, 0xeeee, 0 };
- gtk_widget_modify_bg (widget, GTK_STATE_NORMAL, &bg_color);
- gtk_widget_modify_base (widget, GTK_STATE_NORMAL, &base_color);
+ GdkRGBA bg_color = { 0, 0xffff, 0xaaaa, 0 };
+ GdkRGBA base_color = { 0, 0xffff, 0xeeee, 0 };
+ gtk_widget_override_background_color (widget, GTK_STATE_FLAG_NORMAL, &bg_color);
+ gtk_widget_override_color (widget, GTK_STATE_FLAG_NORMAL, &base_color);
}
else {
- g_signal_connect (G_OBJECT (widget), "expose-event",
- G_CALLBACK (inner::expose_highlight_cb), NULL);
+ g_signal_connect (G_OBJECT (widget), "draw",
+ G_CALLBACK (inner::draw_highlight_cb), NULL);
gtk_widget_queue_draw (widget);
}
}
Modified: trunk/gtk/src/YGDumbTab.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGDumbTab.cc?rev=64969&r…
==============================================================================
--- trunk/gtk/src/YGDumbTab.cc (original)
+++ trunk/gtk/src/YGDumbTab.cc Sat Jul 23 07:43:30 2011
@@ -8,7 +8,7 @@
#include "YGWidget.h"
#include "YGUtils.h"
#include "YDumbTab.h"
-
+#include <gtk/gtk.h>
#include "ygtkratiobox.h"
class YGDumbTab : public YDumbTab, public YGWidget
@@ -141,7 +141,7 @@
}
// callbacks
- static void switch_page_cb (GtkNotebook *notebook, GtkNotebookPage *page,
+ static void switch_page_cb (GtkNotebook *notebook, GtkWidget *page,
guint tab_nb, YGDumbTab *pThis)
{
GtkWidget *child = gtk_notebook_get_nth_page (notebook, tab_nb);
Modified: trunk/gtk/src/YGFrame.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGFrame.cc?rev=64969&r1=…
==============================================================================
--- trunk/gtk/src/YGFrame.cc (original)
+++ trunk/gtk/src/YGFrame.cc Sat Jul 23 07:43:30 2011
@@ -39,10 +39,10 @@
static GtkWidget *findFirstFocusable (GtkContainer *container)
{
g_return_val_if_fail (container != NULL, NULL);
-
+
for (GList *l = gtk_container_get_children (container);
l; l = l->next) {
- if (GTK_WIDGET_CAN_FOCUS (l->data))
+ if (gtk_widget_get_can_focus (GTK_WIDGET(l->data)))
return GTK_WIDGET (l->data);
else if (GTK_IS_CONTAINER (l->data)) {
GtkWidget *ret = findFirstFocusable (GTK_CONTAINER (l->data));
@@ -130,7 +130,7 @@
virtual void setLabel (const string &_str)
{
GtkWidget *button = gtk_frame_get_label_widget (GTK_FRAME (getWidget()));
- GtkLabel *label = GTK_LABEL (GTK_BIN (button)->child);
+ GtkLabel *label = GTK_LABEL (gtk_bin_get_child(GTK_BIN (button)));
string str (YGUtils::mapKBAccel (_str));
gtk_label_set_text_with_mnemonic (label, str.c_str());
Modified: trunk/gtk/src/YGImage.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGImage.cc?rev=64969&r1=…
==============================================================================
--- trunk/gtk/src/YGImage.cc (original)
+++ trunk/gtk/src/YGImage.cc Sat Jul 23 07:43:30 2011
@@ -35,8 +35,12 @@
stock = GTK_STOCK_DIALOG_WARNING;
else if (endsWith (filename, "/msg_error.png"))
stock = GTK_STOCK_DIALOG_ERROR;
- if (stock && gtk_style_lookup_icon_set (m_widget->style, stock)) {
- GdkPixbuf *pixbuf = gtk_widget_render_icon (m_widget, stock, GTK_ICON_SIZE_DIALOG, NULL);
+
+ GtkStyleContext *ctx;
+ ctx = gtk_widget_get_style_context(m_widget);
+
+ if (stock && gtk_style_context_lookup_icon_set (ctx, stock)) {
+ GdkPixbuf *pixbuf = gtk_widget_render_icon_pixbuf (m_widget, stock, GTK_ICON_SIZE_DIALOG);
ygtk_image_set_from_pixbuf (image, pixbuf);
}
else
Modified: trunk/gtk/src/YGLayout.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGLayout.cc?rev=64969&r1…
==============================================================================
--- trunk/gtk/src/YGLayout.cc (original)
+++ trunk/gtk/src/YGLayout.cc Sat Jul 23 07:43:30 2011
@@ -21,16 +21,17 @@
}
#define YGLAYOUT_INIT \
- ygtk_fixed_setup (YGTK_FIXED (getWidget()), preferred_size_cb, set_size_cb, this);
+ ygtk_fixed_setup (YGTK_FIXED (getWidget()), preferred_width_cb, preferred_height_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(); \
+ static gint preferred_width_cb (YGtkFixed *fixed, gpointer pThis) { \
+ return ((ParentClass *) pThis)->ParentClass::preferredWidth(); \
+ } \
+ static gint preferred_height_cb (YGtkFixed *fixed, gpointer pThis) { \
+ return ((ParentClass *) pThis)->ParentClass::preferredHeight(); \
}
-#define YGLAYOUT_SET_SIZE_IMPL(ParentClass) \
+#define YGLAYOUT_SET_SIZE_IMPL(ParentClass) \
static void set_size_cb (YGtkFixed *fixed, gint width, gint height, \
- gpointer pThis) { \
+ gpointer pThis) { \
((ParentClass *) pThis)->ParentClass::setSize (width, height); \
} \
virtual void moveChild (YWidget *ychild, int x, int y) \
@@ -161,7 +162,7 @@
if (filename.empty()) {
m_background_pixbuf = 0;
g_signal_handlers_disconnect_by_func (G_OBJECT (getWidget()),
- (void*) expose_event_cb, this);
+ (void*) draw_event_cb, this);
}
else {
GError *error = 0;
@@ -170,27 +171,22 @@
g_warning ("Setting YAlignment background - couldn't load image '%s' - %s",
filename.c_str(), error->message);
else
- g_signal_connect (G_OBJECT (getWidget()), "expose-event",
- G_CALLBACK (expose_event_cb), this);
+ g_signal_connect (G_OBJECT (getWidget()), "draw",
+ G_CALLBACK (draw_event_cb), this);
}
}
- static gboolean expose_event_cb (GtkWidget *widget, GdkEventExpose *event,
- YGAlignment *pThis)
+ static gboolean draw_event_cb (GtkWidget *widget, cairo_t *cr, int width, int height,
+ YGAlignment *pThis)
{
- GtkAllocation *alloc = &widget->allocation;
- cairo_t *cr = gdk_cairo_create (widget->window);
-
gdk_cairo_set_source_pixbuf (cr, pThis->m_background_pixbuf, 0, 0);
cairo_pattern_set_extend (cairo_get_source (cr), CAIRO_EXTEND_REPEAT);
- cairo_rectangle (cr, alloc->x, alloc->y, alloc->width, alloc->height);
+ cairo_rectangle (cr, 0, 0, width, height);
cairo_fill (cr);
- cairo_destroy (cr);
-
- gtk_container_propagate_expose (GTK_CONTAINER (widget),
- GTK_BIN (widget)->child, event);
+ gtk_container_propagate_draw (GTK_CONTAINER (widget),
+ gtk_bin_get_child(GTK_BIN (widget)), cr);
return TRUE;
}
};
@@ -234,7 +230,7 @@
YGWIDGET_IMPL_COMMON (YSpacing)
YGLAYOUT_PREFERRED_SIZE_IMPL (YSpacing)
- static void set_size_cb (YGtkFixed *fixed, gint width, gint height,
+ static void set_size_cb (YGtkFixed *fixed, gint width, gint height,
gpointer pThis) {}
};
Modified: trunk/gtk/src/YGProgressBar.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGProgressBar.cc?rev=649…
==============================================================================
--- trunk/gtk/src/YGProgressBar.cc (original)
+++ trunk/gtk/src/YGProgressBar.cc Sat Jul 23 07:43:30 2011
@@ -137,8 +137,8 @@
ygtk_ratio_box_set_spacing (YGTK_RATIO_BOX (getWidget()), 2);
for (int s = 0; s < segments(); s++) {
GtkWidget *bar = gtk_progress_bar_new();
- gtk_progress_bar_set_orientation (GTK_PROGRESS_BAR (bar),
- horizontal() ? GTK_PROGRESS_LEFT_TO_RIGHT : GTK_PROGRESS_BOTTOM_TO_TOP);
+ gtk_orientable_set_orientation(GTK_ORIENTABLE(bar), horizontal() ? GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL);
+ gtk_progress_bar_set_inverted(GTK_PROGRESS_BAR (bar), horizontal() ? FALSE : TRUE);
// Progress bars would ask for too much size with weight...
const int min_size = 5;
if (horizontal())
Modified: trunk/gtk/src/YGPushButton.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGPushButton.cc?rev=6496…
==============================================================================
--- trunk/gtk/src/YGPushButton.cc (original)
+++ trunk/gtk/src/YGPushButton.cc Sat Jul 23 07:43:30 2011
@@ -11,6 +11,7 @@
#include <string.h>
#include <YLayoutBox.h>
+#include "ygtkratiobox.h"
class YGPushButton : public YPushButton, public YGWidget
{
@@ -25,7 +26,7 @@
gtk_button_set_use_underline (GTK_BUTTON (getWidget()), TRUE);
setLabel (label);
connect (getWidget(), "clicked", G_CALLBACK (clicked_cb), this);
- g_signal_connect (getWidget(), "size-request", G_CALLBACK (size_request_cb), this);
+ g_signal_connect (getWidget(), "realize", G_CALLBACK (realize_cb), this);
}
void setStockIcon (const std::string &label)
@@ -135,8 +136,8 @@
YPushButton::setDefaultButton (isDefault);
if (isDefault) {
GtkWidget *button = getWidget();
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
- if (GTK_WIDGET_REALIZED (button))
+ gtk_widget_set_can_default(button, TRUE);
+ if (gtk_widget_get_realized (button))
inner::realize_cb (button);
g_signal_connect (G_OBJECT (button), "realize",
G_CALLBACK (inner::realize_cb), this);
@@ -148,7 +149,7 @@
if (dynamic_cast <YPushButton *> (ywidget)) {
GtkWidget *button = YGWidget::get (ywidget)->getWidget();
GtkWidget *icon = gtk_button_get_image (GTK_BUTTON (button));
- return icon && GTK_WIDGET_VISIBLE (icon);
+ return icon && gtk_widget_get_visible (icon);
}
return true;
}
@@ -165,7 +166,7 @@
for (YWidgetListConstIterator it = ybox->childrenBegin();
it != ybox->childrenEnd(); it++) {
if ((YWidget *) pThis == *it) {
- if (ylast && !hasIcon (ylast))
+ if (ylast && !hasIcon (ylast))
pThis->setIcon ("");
break;
}
@@ -205,13 +206,11 @@
#define DEFAULT_CHILD_MIN_WIDTH 85
#define DEFAULT_CHILD_MIN_HEIGHT 27
- static void size_request_cb (GtkWidget *widget, GtkRequisition *req, YGPushButton *pThis)
+ static void realize_cb (GtkWidget *widget, YGPushButton *pThis)
{ // enlarge button if parent is ButtonBox
YWidget *yparent = pThis->m_ywidget->parent();
- if (yparent && !strcmp (yparent->widgetClass(), "YButtonBox")) {
- req->width = MAX (req->width, DEFAULT_CHILD_MIN_WIDTH);
- req->height = MAX (req->height, DEFAULT_CHILD_MIN_HEIGHT);
- }
+ if (yparent && !strcmp (yparent->widgetClass(), "YButtonBox"))
+ ygtk_adj_size_set_min (YGTK_ADJ_SIZE(pThis->getLayout()), DEFAULT_CHILD_MIN_WIDTH, DEFAULT_CHILD_MIN_HEIGHT);
}
YGWIDGET_IMPL_COMMON (YPushButton)
Modified: trunk/gtk/src/YGSelectionStore.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGSelectionStore.h?rev=6…
==============================================================================
--- trunk/gtk/src/YGSelectionStore.h (original)
+++ trunk/gtk/src/YGSelectionStore.h Sat Jul 23 07:43:30 2011
@@ -7,7 +7,7 @@
#ifndef YGSELECTION_STORE_H
#define YGSELECTION_STORE_H
-#include <gtk/gtktreemodel.h>
+#include <gtk/gtk.h>
struct YItem;
struct YSelectionWidget;
Modified: trunk/gtk/src/YGText.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGText.cc?rev=64969&r1=6…
==============================================================================
--- trunk/gtk/src/YGText.cc (original)
+++ trunk/gtk/src/YGText.cc Sat Jul 23 07:43:30 2011
@@ -74,7 +74,7 @@
void scrollToBottom()
{
#if 1
- YGUtils::scrollWidget (GTK_TEXT_VIEW (getWidget())->vadjustment, false);
+ YGUtils::scrollWidget (gtk_scrollable_get_vadjustment(GTK_SCROLLABLE (getWidget())), false);
#else
GtkTextBuffer *buffer = getBuffer();
GtkTextIter iter;
@@ -167,8 +167,8 @@
if (text.size() == m_text.size()) return;
// appending text: avoid flickering and allow user to scroll freely
- GtkAdjustment *vadj = GTK_TEXT_VIEW (getWidget())->vadjustment;
- bool autoScroll = vadj->value >= vadj->upper - vadj->page_size;
+ GtkAdjustment *vadj = gtk_scrollable_get_vadjustment(GTK_SCROLLABLE (getWidget()));
+ bool autoScroll = gtk_adjustment_get_value(vadj) >= gtk_adjustment_get_upper(vadj) - gtk_adjustment_get_page_size(vadj);
std::string diff (text.substr (m_text.size()));
YGTextView::appendText (diff);
Modified: trunk/gtk/src/YGTreeView.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGTreeView.cc?rev=64969&…
==============================================================================
--- trunk/gtk/src/YGTreeView.cc (original)
+++ trunk/gtk/src/YGTreeView.cc Sat Jul 23 07:43:30 2011
@@ -378,7 +378,7 @@
void setSortable (bool sortable)
{
- if (!sortable && !GTK_WIDGET_REALIZED (getWidget()))
+ if (!sortable && !gtk_widget_get_realized (getWidget()))
return;
int n = 0;
GList *columns = gtk_tree_view_get_columns (getView());
@@ -514,7 +514,7 @@
static gboolean key_press_event_cb (GtkWidget *widget, GdkEventKey *event, YGTable *pThis)
{
- if (event->keyval == GDK_Delete) {
+ if (event->keyval == GDK_KEY_Delete) {
YWidget *button = YGDialog::currentDialog()->getFunctionWidget (5);
if (button)
activateButton (button);
Modified: trunk/gtk/src/YGUI.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGUI.cc?rev=64969&r1=649…
==============================================================================
--- trunk/gtk/src/YGUI.cc (original)
+++ trunk/gtk/src/YGUI.cc Sat Jul 23 07:43:30 2011
@@ -356,11 +356,14 @@
return;
}
+ GtkAllocation alloc;
+ gtk_widget_get_allocation(widget, &alloc);
+
GError *error = 0;
GdkPixbuf *shot =
- gdk_pixbuf_get_from_drawable (NULL, GDK_DRAWABLE (widget->window),
- gdk_colormap_get_system(), 0, 0, 0, 0, widget->allocation.width,
- widget->allocation.height);
+ gdk_pixbuf_get_from_window (gtk_widget_get_window(widget),
+ 0, 0, alloc.width,
+ alloc.height);
if (!shot) {
if (interactive)
@@ -601,52 +604,3 @@
YApplication *YGUI::createApplication()
{ return new YGApplication(); }
-#include <YRichText.h>
-#include "ygtktextview.h"
-
-void dumpYastHtml (YWidget *widget)
-{
- struct inner {
- static void dumpYastHtml (YWidget *widget, GtkBox *box)
- {
- YGWidget *ygwidget;
- if (!widget || !(ygwidget = YGWidget::get (widget)))
- return;
-
- YRichText *rtext = dynamic_cast <YRichText *> (widget);
- if (rtext) {
- std::string text = rtext->text();
-
- GtkWidget *view = ygtk_text_view_new (FALSE);
- gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (view), GTK_WRAP_WORD);
- GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
- gtk_text_buffer_set_text (buffer, text.c_str(), -1);
-
- GtkWidget *scroll = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scroll),
- GTK_SHADOW_IN);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll),
- GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- gtk_container_add (GTK_CONTAINER (scroll), view);
- gtk_box_pack_start (box, scroll, TRUE, TRUE, 6);
- }
-
- for (YWidgetListConstIterator it = widget->childrenBegin();
- it != widget->childrenEnd(); it++)
- dumpYastHtml (*it, box);
- }
- static void destroy_dialog (GtkDialog *dialog, gint arg)
- { gtk_widget_destroy (GTK_WIDGET (dialog)); }
- };
-
- GtkWidget *dialog = gtk_dialog_new_with_buttons ("YWidgets HTML", NULL,
- GtkDialogFlags (GTK_DIALOG_NO_SEPARATOR), GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL);
- gtk_window_set_default_size (GTK_WINDOW (dialog), 400, 300);
-
- inner::dumpYastHtml (widget, GTK_BOX (GTK_DIALOG (dialog)->vbox));
-
- gtk_widget_show_all (dialog);
- g_signal_connect (G_OBJECT (dialog), "response",
- G_CALLBACK (inner::destroy_dialog), 0);
-}
-
Modified: trunk/gtk/src/YGUI.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGUI.h?rev=64969&r1=6496…
==============================================================================
--- trunk/gtk/src/YGUI.h (original)
+++ trunk/gtk/src/YGUI.h Sat Jul 23 07:43:30 2011
@@ -72,10 +72,6 @@
bool isSwsingle() const { return m_swsingle; }
};
-// debug helpers.
-void dumpTree (YWidget *widget);
-void dumpYastHtml (YWidget *widget);
-
#include <YWidgetFactory.h>
class YGWidgetFactory : public YWidgetFactory
Modified: trunk/gtk/src/YGUtils.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGUtils.cc?rev=64969&r1=…
==============================================================================
--- trunk/gtk/src/YGUtils.cc (original)
+++ trunk/gtk/src/YGUtils.cc Sat Jul 23 07:43:30 2011
@@ -411,14 +411,14 @@
static gboolean scroll_down_cb (void *pData)
{
GtkAdjustment *vadj = (GtkAdjustment *) pData;
- gtk_adjustment_set_value (vadj, vadj->upper - vadj->page_size);
+ gtk_adjustment_set_value (vadj, gtk_adjustment_get_upper(vadj) - gtk_adjustment_get_page_size(vadj));
return FALSE;
}
void YGUtils::scrollWidget (GtkAdjustment *vadj, bool top)
{
if (top)
- gtk_adjustment_set_value (vadj, vadj->lower);
+ gtk_adjustment_set_value (vadj, gtk_adjustment_get_lower(vadj));
else
// since we usually want to call this together with a text change, we
// must wait till that gets in effect
@@ -460,9 +460,10 @@
int YGUtils::getCharsWidth (GtkWidget *widget, int chars_nb)
{
+ GtkStyleContext *style_ctx = gtk_widget_get_style_context(widget);
PangoContext *context = gtk_widget_get_pango_context (widget);
PangoFontMetrics *metrics = pango_context_get_metrics (context,
- widget->style->font_desc, NULL);
+ gtk_style_context_get_font(style_ctx, GTK_STATE_FLAG_NORMAL), NULL);
int width = pango_font_metrics_get_approximate_char_width (metrics);
pango_font_metrics_unref (metrics);
@@ -472,9 +473,10 @@
int YGUtils::getCharsHeight (GtkWidget *widget, int chars_nb)
{
+ GtkStyleContext *style_ctx = gtk_widget_get_style_context(widget);
PangoContext *context = gtk_widget_get_pango_context (widget);
PangoFontMetrics *metrics = pango_context_get_metrics (context,
- widget->style->font_desc, NULL);
+ gtk_style_context_get_font(style_ctx, GTK_STATE_FLAG_NORMAL), NULL);
int height = pango_font_metrics_get_ascent (metrics) +
pango_font_metrics_get_descent (metrics);
@@ -486,13 +488,15 @@
void YGUtils::setWidgetFont (GtkWidget *widget, PangoStyle style, PangoWeight weight,
double scale)
{
- PangoFontDescription *font_desc = widget->style->font_desc;
+ GtkStyleContext *style_ctx = gtk_widget_get_style_context(widget);
+ const PangoFontDescription *font_desc = gtk_style_context_get_font(style_ctx, GTK_STATE_FLAG_NORMAL);
+
int size = pango_font_description_get_size (font_desc);
PangoFontDescription* font = pango_font_description_new();
pango_font_description_set_weight (font, weight);
pango_font_description_set_size (font, (int)(size * scale));
pango_font_description_set_style (font, style);
- gtk_widget_modify_font (widget, font);
+ gtk_widget_override_font (widget, font);
pango_font_description_free (font);
}
@@ -504,10 +508,13 @@
if (!g_object_get_data (G_OBJECT (paned), "init")) { // only once
gdouble rel = GPOINTER_TO_INT (_rel) / 100.;
gint parent_size;
+ GtkAllocation alloc;
+ gtk_widget_get_allocation(paned, &alloc);
+
if (gtk_orientable_get_orientation (GTK_ORIENTABLE (paned)) == GTK_ORIENTATION_HORIZONTAL)
- parent_size = paned->allocation.width;
+ parent_size = alloc.width;
else
- parent_size = paned->allocation.height;
+ parent_size = alloc.height;
int pos = parent_size * rel;
gtk_paned_set_position (GTK_PANED (paned), pos);
g_object_set_data (G_OBJECT (paned), "init", GINT_TO_POINTER (1));
@@ -711,10 +718,12 @@
const char *fallbackIcon)
{
const char *icon = mapStockIcon (label);
+ GtkStyleContext *ctx = gtk_widget_get_style_context(button);
+
if (!icon && label.size() < 22)
icon = fallbackIcon;
if (icon) {
- if (gtk_style_lookup_icon_set (button->style, icon)) {
+ if (gtk_style_context_lookup_icon_set (ctx, icon)) {
// we want to use GtkImage stock mode so it honors sensitive
GtkWidget *image = gtk_image_new_from_stock (icon, GTK_ICON_SIZE_BUTTON);
gtk_button_set_image (GTK_BUTTON (button), image);
@@ -731,19 +740,26 @@
void YGUtils::shrinkWidget (GtkWidget *widget)
{
static bool first_time = true;
+ GtkCssProvider *provider;
+
if (first_time) {
- first_time = false;
- gtk_rc_parse_string (
- "style \"small-widget-style\"\n"
+ provider = gtk_css_provider_new ();
+ gtk_css_provider_load_from_data (provider,
+ "style \"small-widget-style\"\n"
"{\n"
" GtkWidget::focus-padding = 0\n"
" GtkWidget::focus-line-width = 0\n"
" xthickness = 0\n"
" ythickness = 0\n"
"}\n"
- "widget \"*.small-widget\" style \"small-widget-style\"");
- }
- gtk_widget_set_name (widget, "small-widget");
+ "widget \"*.small-widget\" style \"small-widget-style\"", -1, NULL);
+ gtk_style_context_add_provider (gtk_widget_get_style_context (widget),
+ GTK_STYLE_PROVIDER (provider),
+ GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+ g_object_unref (provider);
+ gtk_widget_set_name (widget, "small-widget");
+ first_time = false;
+ }
}
/*
@@ -764,7 +780,7 @@
for (; text[i]; i++)
if (text[i] == '>')
break;
-
+
if (!strncasecmp (text+a, "<h", 2) || !strncasecmp (text+a, "<big>", 5) ||
(!str->len && !strncasecmp (text+a, "<b>", 3))) {
for (i++; text[i]; i++) {
Modified: trunk/gtk/src/YGUtils.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGUtils.h?rev=64969&r1=6…
==============================================================================
--- trunk/gtk/src/YGUtils.h (original)
+++ trunk/gtk/src/YGUtils.h Sat Jul 23 07:43:30 2011
@@ -7,8 +7,7 @@
#include <string>
#include <list>
-#include <gtk/gtktextview.h>
-#include <gtk/gtkentry.h>
+#include <gtk/gtk.h>
/* YGUtils.h/cc have some functionality that is shared between different parts
of the code. */
Modified: trunk/gtk/src/YGWidget.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGWidget.cc?rev=64969&r1…
==============================================================================
--- trunk/gtk/src/YGWidget.cc (original)
+++ trunk/gtk/src/YGWidget.cc Sat Jul 23 07:43:30 2011
@@ -54,7 +54,7 @@
static void min_size_cb (guint *min_width, guint *min_height, gpointer pData);
YGWidget::YGWidget(YWidget *ywidget, YWidget *yparent,
- GtkType type, const char *property_name, ...)
+ GType type, const char *property_name, ...)
: m_ywidget (ywidget)
{
va_list args;
@@ -157,7 +157,7 @@
{
// We might want to do some caching here..
GtkRequisition req;
- gtk_widget_size_request (m_adj_size, &req);
+ gtk_widget_get_preferred_size (m_adj_size, &req, NULL);
return dimension == YD_HORIZ ? req.width : req.height;
}
Modified: trunk/gtk/src/pkg/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/CMakeLists.txt?rev=6…
==============================================================================
--- trunk/gtk/src/pkg/CMakeLists.txt (original)
+++ trunk/gtk/src/pkg/CMakeLists.txt Sat Jul 23 07:43:30 2011
@@ -43,11 +43,12 @@
## libraries:
target_link_libraries (py2gtk_pkg libpy2gtk.so)
-target_link_libraries (py2gtk_pkg ${GTK2_LIBRARIES})
+target_link_libraries (py2gtk_pkg ${GTK3_LIBRARIES})
target_link_libraries (py2gtk_pkg ${LIBYUI_LIBRARY})
target_link_libraries (py2gtk_pkg ${ZYPP_LIBRARY})
set_target_properties (py2gtk_pkg PROPERTIES SOVERSION 2)
-set_target_properties (py2gtk_pkg PROPERTIES LINK_FLAGS "--no-undefined -Wl,-rpath -Wl,${UI_PLUGIN_DIR}")
+#set_target_properties (py2gtk_pkg PROPERTIES LINK_FLAGS "--no-undefined -Wl,-rpath -Wl,${UI_PLUGIN_DIR}")
+set_target_properties (py2gtk_pkg PROPERTIES LINK_FLAGS "-Wl,-rpath -Wl,${UI_PLUGIN_DIR}")
## install:
Modified: trunk/gtk/src/pkg/YGPackageSelector.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/YGPackageSelector.cc…
==============================================================================
--- trunk/gtk/src/pkg/YGPackageSelector.cc (original)
+++ trunk/gtk/src/pkg/YGPackageSelector.cc Sat Jul 23 07:43:30 2011
@@ -258,7 +258,7 @@
(GTK_SCROLLED_WINDOW (scroll), GTK_SHADOW_IN);
gtk_container_add (GTK_CONTAINER (scroll), view);
- GtkBox *vbox = GTK_BOX (GTK_DIALOG(dialog)->vbox);
+ GtkBox *vbox = GTK_BOX (gtk_dialog_get_content_area(GTK_DIALOG(dialog)));
gtk_box_pack_start (vbox, scroll, TRUE, TRUE, 6);
gtk_window_set_resizable (GTK_WINDOW (dialog), TRUE);
@@ -411,7 +411,7 @@
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scroll),
GTK_SHADOW_IN);
gtk_container_add (GTK_CONTAINER (scroll), view);
- gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), scroll);
+ gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area(GTK_DIALOG (dialog))), scroll);
gtk_window_set_resizable (GTK_WINDOW (dialog), TRUE);
gtk_window_set_default_size (GTK_WINDOW (dialog), -1, 500);
@@ -603,6 +603,13 @@
{ return Ypp::Package (sel).support() <= 1; }
};
+ Ypp::PoolQuery query (Ypp::Selectable::PACKAGE);
+ query.addCriteria (new Ypp::StatusMatch (Ypp::StatusMatch::TO_MODIFY));
+ query.addCriteria (new UnsupportedMatch());
+ Ypp::List list (query);
+ if(list.size() == 0)
+ return true;
+
GtkWidget *dialog = gtk_message_dialog_new (YGDialog::currentWindow(),
GtkDialogFlags (0), GTK_MESSAGE_WARNING, GTK_BUTTONS_NONE,
_("Unsupported packages"));
@@ -615,11 +622,6 @@
gtk_window_set_resizable (GTK_WINDOW (dialog), TRUE);
gtk_window_set_default_size (GTK_WINDOW (dialog), 600, 500);
- Ypp::PoolQuery query (Ypp::Selectable::PACKAGE);
- query.addCriteria (new Ypp::StatusMatch (Ypp::StatusMatch::TO_MODIFY));
- query.addCriteria (new UnsupportedMatch());
- Ypp::List list (query);
-
YGtkPkgListView view (true, Ypp::List::NAME_SORT, false, true);
view.addCheckColumn (INSTALLED_CHECK_PROP);
view.addTextColumn (_("Name"), NAME_SUMMARY_PROP, true, -1);
@@ -629,7 +631,7 @@
view.setListener (this);
view.setList (list);
- gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), view.getWidget());
+ gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area(GTK_DIALOG (dialog))), view.getWidget());
gtk_widget_show_all (dialog);
int ret = gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
Modified: trunk/gtk/src/pkg/ygtkcellrendererbutton.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkcellrendererbutt…
==============================================================================
--- trunk/gtk/src/pkg/ygtkcellrendererbutton.c (original)
+++ trunk/gtk/src/pkg/ygtkcellrendererbutton.c Sat Jul 23 07:43:30 2011
@@ -31,9 +31,7 @@
{
bcell->active = FALSE;
GtkCellRenderer *cell = GTK_CELL_RENDERER (bcell);
- cell->xpad = BORDER;
- cell->ypad = BORDER;
- cell->mode = GTK_CELL_RENDERER_MODE_ACTIVATABLE;
+ g_object_set(cell, "xpad", BORDER, "ypad", BORDER, "mode", GTK_CELL_RENDERER_MODE_ACTIVATABLE, NULL);
bcell->icon_size = 16;
}
@@ -118,14 +116,19 @@
static PangoLayout *create_layout (YGtkCellRendererButton *bcell, GtkWidget *widget)
{
GtkCellRendererText *tcell = GTK_CELL_RENDERER_TEXT (bcell);
- if (tcell->text)
- return gtk_widget_create_pango_layout (widget, tcell->text);
- return NULL;
+ gchar *text = NULL;
+ g_object_get (G_OBJECT (tcell), "text", &text, NULL);
+ PangoLayout *layout = NULL;
+ if (text) {
+ layout = gtk_widget_create_pango_layout (widget, text);
+ g_free(text);
+ }
+ return layout;
}
static void ensure_pixbuf (YGtkCellRendererButton *cell, GtkWidget *widget)
{
- if ((cell->icon_name || cell->stock_id) && !cell->pixbuf) {
+ if (!cell->pixbuf && (cell->icon_name || cell->stock_id)) {
if (cell->icon_name) {
GtkIconTheme *theme = gtk_icon_theme_get_default();
GError *error = 0;
@@ -136,13 +139,13 @@
cell->icon_name, error->message);
}
else // stock-id
- cell->pixbuf = gtk_widget_render_icon (widget, cell->stock_id,
- GTK_ICON_SIZE_BUTTON, "button");
+ cell->pixbuf = gtk_widget_render_icon_pixbuf (
+ widget, cell->stock_id, GTK_ICON_SIZE_BUTTON);
}
}
static void ygtk_cell_renderer_button_get_size_full (GtkCellRenderer *cell,
- GtkWidget *widget, GdkRectangle *cell_area, gint *_xoffset, gint *_yoffset,
+ GtkWidget *widget, const GdkRectangle *cell_area, gint *_xoffset, gint *_yoffset,
gint *_width, gint *_height, gint *_pixbuf_xoffset, gint *_pixbuf_yoffset,
gint *_pixbuf_width, gint *_pixbuf_height, gint *_text_xoffset, gint *_text_yoffset)
{
@@ -170,28 +173,35 @@
width += PIXBUF_TEXT_SPACING;
height = MAX (pixbuf_height, text_height);
+ gfloat xalign, yalign;
+ guint xpad, ypad;
+ g_object_get(cell,
+ "xalign", &xalign,
+ "yalign", &yalign,
+ "xpad", &xpad,
+ "ypad", &ypad, NULL);
+
if (cell_area) {
gboolean reverse = gtk_widget_get_default_direction() == GTK_TEXT_DIR_RTL;
- gfloat xalign = cell->xalign, yalign = cell->yalign;
if (reverse)
xalign = 1.0 - xalign;
- int cell_width = cell_area->width - cell->xpad*2,
- cell_height = cell_area->height - cell->ypad*2;
- int xoffset = (xalign * (cell_width - width)) + cell->xpad;
- int yoffset = (yalign * (cell_height - height)) + cell->ypad;
+ int cell_width = cell_area->width - xpad*2,
+ cell_height = cell_area->height - ypad*2;
+ int xoffset = (xalign * (cell_width - width)) + xpad;
+ int yoffset = (yalign * (cell_height - height)) + ypad;
if (_xoffset) *_xoffset = xoffset;
if (_yoffset) *_yoffset = yoffset;
int text_x = xoffset, text_y;
if (pixbuf_width && !reverse)
text_x += (pixbuf_width + PIXBUF_TEXT_SPACING);
- text_y = (yalign * (cell_height - text_height)) + cell->ypad;
+ text_y = (yalign * (cell_height - text_height)) + ypad;
int pixbuf_x = xoffset, pixbuf_y;
if (text_width && reverse)
pixbuf_x += (text_width + PIXBUF_TEXT_SPACING);
- pixbuf_y = (yalign * (cell_height - pixbuf_height)) + cell->ypad;
+ pixbuf_y = (yalign * (cell_height - pixbuf_height)) + ypad;
if (_pixbuf_xoffset) *_pixbuf_xoffset = pixbuf_x;
if (_pixbuf_yoffset) *_pixbuf_yoffset = pixbuf_y;
@@ -201,39 +211,37 @@
if (_text_yoffset) *_text_yoffset = text_y;
}
- if (_width) *_width = width + (cell->xpad * 2);
- if (_height) *_height = height + (cell->ypad * 2);
+ if (_width) *_width = width + (xpad * 2);
+ if (_height) *_height = height + (ypad * 2);
}
static void ygtk_cell_renderer_button_get_size (GtkCellRenderer *cell,
- GtkWidget *widget, GdkRectangle *cell_area, gint *xoffset, gint *yoffset,
+ GtkWidget *widget, const GdkRectangle *cell_area, gint *xoffset, gint *yoffset,
gint *width, gint *height)
{
ygtk_cell_renderer_button_get_size_full (cell, widget, cell_area,
xoffset, yoffset, width, height, NULL, NULL, NULL, NULL, NULL, NULL);
}
-static void ygtk_cell_renderer_button_render (GtkCellRenderer *cell,
- GdkDrawable *window, GtkWidget *widget, GdkRectangle *background_area,
- GdkRectangle *cell_area, GdkRectangle *expose_area, GtkCellRendererState flags)
+static void ygtk_cell_renderer_button_render(
+ GtkCellRenderer *cell, cairo_t *cr, GtkWidget *widget,
+ const GdkRectangle *background_area, const GdkRectangle *cell_area,
+ GtkCellRendererState flags)
{
YGtkCellRendererButton *bcell = YGTK_CELL_RENDERER_BUTTON (cell);
- gboolean has_focus = FALSE;
- if (flags & GTK_CELL_RENDERER_SELECTED)
- has_focus = GTK_WIDGET_HAS_FOCUS (widget);
-
GtkStateType state = GTK_STATE_NORMAL;
- if (!cell->sensitive || GTK_WIDGET_STATE (widget) == GTK_STATE_INSENSITIVE)
+ if (!gtk_cell_renderer_get_sensitive(cell) || gtk_widget_get_state (widget) == GTK_STATE_INSENSITIVE)
state = GTK_STATE_INSENSITIVE;
else if ((flags & GTK_CELL_RENDERER_PRELIT))
state = GTK_STATE_PRELIGHT;
-
- GtkShadowType shadow = GTK_SHADOW_OUT;
- if (bcell->active) {
- shadow = GTK_SHADOW_IN;
+ if (bcell->active)
state = GTK_STATE_ACTIVE;
- }
+
+ GtkStyleContext *style = gtk_widget_get_style_context(widget);
+ gtk_style_context_save(style);
+ gtk_style_context_set_state(style, state);
+ gtk_style_context_add_class (style, GTK_STYLE_CLASS_BUTTON);
int text_xoffset, text_yoffset, pixbuf_xoffset, pixbuf_yoffset, pixbuf_width,
pixbuf_height, width, height;
@@ -245,41 +253,39 @@
int y = cell_area->y + (cell_area->height - height)/2 + OUTER_BORDER;
width -= OUTER_BORDER*2; height -= OUTER_BORDER*2;
- gtk_paint_box (widget->style, window, state, shadow, expose_area, widget,
- "button", x, y, width, height);
+ gtk_render_background (style, cr, x, y, width, height);
+ gtk_render_frame (style, cr, x, y, width, height);
- int cell_area_x = cell_area->x, cell_area_y = cell_area->y;
- if (bcell->active) {
- cell_area->x += DEPRESS_PAD;
- cell_area->y += DEPRESS_PAD;
- }
+ // paint content
- // paint
ensure_pixbuf (bcell, widget);
if (bcell->pixbuf) {
- int x = cell_area->x + pixbuf_xoffset, y = cell_area->y + pixbuf_yoffset;
- cairo_t *cr = gdk_cairo_create (window);
- gdk_cairo_set_source_pixbuf (cr, bcell->pixbuf, x, y);
- cairo_rectangle (cr, x, y, pixbuf_width, pixbuf_height);
+ int _x = x + pixbuf_xoffset, _y = y + pixbuf_yoffset;
+ if (bcell->active) {
+ _x += DEPRESS_PAD; _y += DEPRESS_PAD;
+ }
+ gdk_cairo_set_source_pixbuf (cr, bcell->pixbuf, _x, _y);
+ cairo_rectangle (cr, _x, _y, pixbuf_width, pixbuf_height);
cairo_fill (cr);
- cairo_destroy (cr);
}
PangoLayout *layout = create_layout (bcell, widget);
if (layout) {
- int x = cell_area->x + text_xoffset, y = cell_area->y + text_yoffset;
- GtkStyle *style = gtk_widget_get_style (widget);
- gtk_paint_layout (style, window, state, TRUE, expose_area, widget,
- "cellrenderertext", x, y, layout);
+ int _x = cell_area->x + text_xoffset, _y = cell_area->y + text_yoffset;
+ if (bcell->active) {
+ _x += DEPRESS_PAD; _y += DEPRESS_PAD;
+ }
+
+ gtk_render_layout(style, cr, _x, _y, layout);
g_object_unref (G_OBJECT (layout));
}
- cell_area->x = cell_area_x; cell_area->y = cell_area_y;
+ gtk_style_context_restore(style);
}
static gboolean ygtk_cell_renderer_button_activate (GtkCellRenderer *cell,
- GdkEvent *event, GtkWidget *widget, const gchar *path, GdkRectangle *background_area,
- GdkRectangle *cell_area, GtkCellRendererState flags)
+ GdkEvent *event, GtkWidget *widget, const gchar *path, const GdkRectangle *background_area,
+ const GdkRectangle *cell_area, GtkCellRendererState flags)
{
GdkEventButton *_event = &event->button;
if (_event->x >= cell_area->x && _event->x <= cell_area->x + cell_area->width) {
Modified: trunk/gtk/src/pkg/ygtkcellrendererbutton.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkcellrendererbutt…
==============================================================================
--- trunk/gtk/src/pkg/ygtkcellrendererbutton.h (original)
+++ trunk/gtk/src/pkg/ygtkcellrendererbutton.h Sat Jul 23 07:43:30 2011
@@ -8,7 +8,7 @@
#ifndef YGTK_CELL_RENDERER_BUTTON_H
#define YGTK_CELL_RENDERER_BUTTON_H
-#include <gtk/gtkcellrenderertext.h>
+#include <gtk/gtk.h>
G_BEGIN_DECLS
#define YGTK_TYPE_CELL_RENDERER_BUTTON (ygtk_cell_renderer_button_get_type ())
Modified: trunk/gtk/src/pkg/ygtkcellrenderersidebutton.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkcellrendererside…
==============================================================================
--- trunk/gtk/src/pkg/ygtkcellrenderersidebutton.c (original)
+++ trunk/gtk/src/pkg/ygtkcellrenderersidebutton.c Sat Jul 23 07:43:30 2011
@@ -20,7 +20,7 @@
G_DEFINE_TYPE (YGtkCellRendererSideButton, ygtk_cell_renderer_side_button, GTK_TYPE_CELL_RENDERER_TEXT)
static void ygtk_cell_renderer_side_button_init (YGtkCellRendererSideButton *bcell)
-{ GTK_CELL_RENDERER (bcell)->mode = GTK_CELL_RENDERER_MODE_ACTIVATABLE; }
+{ g_object_set(GTK_CELL_RENDERER(bcell), "mode", GTK_CELL_RENDERER_MODE_ACTIVATABLE, NULL); }
static void free_pixbuf (YGtkCellRendererSideButton *cell)
{
@@ -93,7 +93,7 @@
}
static void ygtk_cell_renderer_side_button_get_size (
- GtkCellRenderer *cell, GtkWidget *widget, GdkRectangle *cell_area,
+ GtkCellRenderer *cell, GtkWidget *widget, const GdkRectangle *cell_area,
gint *x_offset, gint *y_offset, gint *width, gint *height)
{
GTK_CELL_RENDERER_CLASS (ygtk_cell_renderer_side_button_parent_class)->get_size (
@@ -107,9 +107,9 @@
}
static void ygtk_cell_renderer_side_button_render (
- GtkCellRenderer *cell, GdkDrawable *window, GtkWidget *widget,
- GdkRectangle *background_area, GdkRectangle *cell_area,
- GdkRectangle *expose_area, GtkCellRendererState flags)
+ GtkCellRenderer *cell, cairo_t *cr, GtkWidget *widget,
+ const GdkRectangle *background_area, const GdkRectangle *cell_area,
+ GtkCellRendererState flags)
{
YGtkCellRendererSideButton *bcell = YGTK_CELL_RENDERER_SIDE_BUTTON (cell);
GdkRectangle text_area = *cell_area;
@@ -120,20 +120,25 @@
text_area.x += icon_width + 8;
text_area.width -= icon_width + 8 + 4;
}
+
GTK_CELL_RENDERER_CLASS (ygtk_cell_renderer_side_button_parent_class)->render (
- cell, window, widget, background_area, &text_area, expose_area, flags);
+ cell, cr, widget, background_area, &text_area, flags);
if (bcell->button_visible) {
GtkStateType state = GTK_STATE_NORMAL;
- GtkShadowType shadow = GTK_SHADOW_OUT;
- if (!cell->sensitive || GTK_WIDGET_STATE (widget) == GTK_STATE_INSENSITIVE)
+ gboolean sensitive = TRUE;
+ g_object_get(cell, "sensitive", &sensitive, NULL);
+ if (!sensitive || gtk_widget_get_state (widget) == GTK_STATE_INSENSITIVE)
state = GTK_STATE_INSENSITIVE;
/* else if ((flags & GTK_CELL_RENDERER_PRELIT))
state = GTK_STATE_PRELIGHT;*/
- if (bcell->active) {
- shadow = GTK_SHADOW_IN;
+ if (bcell->active)
state = GTK_STATE_ACTIVE;
- }
+
+ GtkStyleContext *style = gtk_widget_get_style_context(widget);
+ gtk_style_context_save(style);
+ gtk_style_context_set_state(style, state);
+ gtk_style_context_add_class (style, GTK_STYLE_CLASS_BUTTON);
GdkRectangle button_area = *cell_area;
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
@@ -143,29 +148,30 @@
button_area.width = icon_width + 4;
button_area.height = icon_height + 4;
button_area.y = cell_area->y + ((cell_area->height - button_area.height) / 2);
- gtk_paint_box (widget->style, window, state, shadow, expose_area, widget,
- "button", button_area.x, button_area.y, button_area.width, button_area.height);
+
+ gtk_render_background (style, cr, button_area.x, button_area.y, button_area.width, button_area.height);
+ gtk_render_frame (style, cr, button_area.x, button_area.y, button_area.width, button_area.height);
GdkRectangle icon_area = button_area;
icon_area.x += 2;
icon_area.y += 2;
if (bcell->active) {
- cell_area->x += 2;
- cell_area->y += 2;
+ icon_area.x += 2;
+ icon_area.y += 2;
}
ensure_pixbuf (bcell, widget);
- cairo_t *cr = gdk_cairo_create (window);
gdk_cairo_set_source_pixbuf (cr, bcell->pixbuf, icon_area.x, icon_area.y);
cairo_rectangle (cr, icon_area.x, icon_area.y, icon_width, icon_height);
cairo_fill (cr);
- cairo_destroy (cr);
+
+ gtk_style_context_restore(style);
}
}
static gboolean ygtk_cell_renderer_side_button_activate (
GtkCellRenderer *cell, GdkEvent *event, GtkWidget *widget, const gchar *path,
- GdkRectangle *background_area, GdkRectangle *cell_area, GtkCellRendererState flags)
+ const GdkRectangle *background_area, const GdkRectangle *cell_area, GtkCellRendererState flags)
{
YGtkCellRendererSideButton *bcell = YGTK_CELL_RENDERER_SIDE_BUTTON (cell);
if (bcell->button_visible) {
Modified: trunk/gtk/src/pkg/ygtkcellrenderersidebutton.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkcellrendererside…
==============================================================================
--- trunk/gtk/src/pkg/ygtkcellrenderersidebutton.h (original)
+++ trunk/gtk/src/pkg/ygtkcellrenderersidebutton.h Sat Jul 23 07:43:30 2011
@@ -8,7 +8,7 @@
#ifndef YGTK_CELL_RENDERER_SIDE_BUTTON_H
#define YGTK_CELL_RENDERER_SIDE_BUTTON_H
-#include <gtk/gtkcellrenderertext.h>
+#include <gtk/gtk.h>
G_BEGIN_DECLS
#define YGTK_TYPE_CELL_RENDERER_SIDE_BUTTON (ygtk_cell_renderer_side_button_get_type())
Modified: trunk/gtk/src/pkg/ygtkcellrenderertext.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkcellrenderertext…
==============================================================================
--- trunk/gtk/src/pkg/ygtkcellrenderertext.c (original)
+++ trunk/gtk/src/pkg/ygtkcellrenderertext.c Sat Jul 23 07:43:30 2011
@@ -21,27 +21,32 @@
}
static void ygtk_cell_renderer_text_render (
- GtkCellRenderer *cell, GdkDrawable *window, GtkWidget *widget,
- GdkRectangle *background_area, GdkRectangle *cell_area,
- GdkRectangle *expose_area, GtkCellRendererState flags)
+ GtkCellRenderer *cell, cairo_t *cr, GtkWidget *widget,
+ const GdkRectangle *background_area, const GdkRectangle *cell_area,
+ GtkCellRendererState flags)
{
+ // hack: disable our color attributes when the text is selected,
+ // so that the text is visible against the blue background
GtkCellRendererText *tcell = GTK_CELL_RENDERER_TEXT (cell);
PangoAttrList *old_extra_attrs = 0, *new_extra_attrs = 0;
if (flags & (GTK_CELL_RENDERER_SELECTED | GTK_CELL_RENDERER_INSENSITIVE)) {
- old_extra_attrs = pango_attr_list_copy (tcell->extra_attrs);
- new_extra_attrs = tcell->extra_attrs;
+ g_object_get(tcell, "attributes", &old_extra_attrs, NULL);
+ g_object_get(tcell, "attributes", &new_extra_attrs, NULL);
- PangoAttrList *t = pango_attr_list_filter (tcell->extra_attrs,
+ PangoAttrList *t = pango_attr_list_filter (new_extra_attrs,
filter_color_cb, NULL);
+
+ g_object_set(tcell, "attributes", new_extra_attrs, NULL);
+ pango_attr_list_unref (new_extra_attrs);
pango_attr_list_unref (t);
}
GTK_CELL_RENDERER_CLASS (ygtk_cell_renderer_text_parent_class)->render (
- cell, window, widget, background_area, cell_area, expose_area, flags);
+ cell, cr, widget, background_area, cell_area, flags);
if (old_extra_attrs) {
- tcell->extra_attrs = old_extra_attrs;
- pango_attr_list_unref (new_extra_attrs);
+ g_object_set(tcell, "attributes", old_extra_attrs, NULL);
+ pango_attr_list_unref (old_extra_attrs);
}
}
Modified: trunk/gtk/src/pkg/ygtkcellrenderertext.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkcellrenderertext…
==============================================================================
--- trunk/gtk/src/pkg/ygtkcellrenderertext.h (original)
+++ trunk/gtk/src/pkg/ygtkcellrenderertext.h Sat Jul 23 07:43:30 2011
@@ -9,7 +9,7 @@
#ifndef YGTK_CELL_RENDERER_TEXT_H
#define YGTK_CELL_RENDERER_TEXT_H
-#include <gtk/gtkcellrenderertext.h>
+#include <gtk/gtk.h>
G_BEGIN_DECLS
#define YGTK_TYPE_CELL_RENDERER_TEXT (ygtk_cell_renderer_text_get_type())
Modified: trunk/gtk/src/pkg/ygtkpkgdetailview.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpkgdetailview.cc…
==============================================================================
--- trunk/gtk/src/pkg/ygtkpkgdetailview.cc (original)
+++ trunk/gtk/src/pkg/ygtkpkgdetailview.cc Sat Jul 23 07:43:30 2011
@@ -209,7 +209,7 @@
G_CALLBACK (copy_link_cb), pThis);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
}
- gtk_menu_popup (GTK_MENU (pThis->popup), NULL, NULL, NULL, NULL,
+ gtk_menu_popup (GTK_MENU (pThis->popup), NULL, NULL, NULL, NULL,
0, gtk_get_current_event_time());
pThis->link_str = link;
}
@@ -394,7 +394,7 @@
GtkWidget *widget = hbox;
if ((versions.size() % 2) == 1)
- g_signal_connect (G_OBJECT (widget), "expose-event",
+ g_signal_connect (G_OBJECT (widget), "draw",
G_CALLBACK (draw_gray_cb), NULL);
versions.push_back (version);
gtk_box_pack_start (GTK_BOX (versions_box), widget, FALSE, TRUE, 0);
@@ -615,17 +615,15 @@
g_list_free (children);
}
- static gboolean draw_gray_cb (GtkWidget *widget, GdkEventExpose *event)
+ static gboolean draw_gray_cb (GtkWidget *widget, cairo_t *cr)
{
- GtkAllocation *alloc = &widget->allocation;
- int x = alloc->x, y = alloc->y, w = alloc->width, h = alloc->height;
+ int w = gtk_widget_get_allocated_width(widget);
+ int h = gtk_widget_get_allocated_height(widget);
- cairo_t *cr = gdk_cairo_create (widget->window);
- cairo_rectangle (cr, x, y, w, h);
+ cairo_rectangle (cr, 0, 0, w, h);
// use alpha to cope with styles who might not have a white background
cairo_set_source_rgba (cr, 0, 0, 0, .060);
cairo_fill (cr);
- cairo_destroy (cr);
return FALSE;
}
};
@@ -771,7 +769,7 @@
static const char *getLabel (int dep)
{
-
+
switch ((zypp::Dep::for_use_in_switch) dep) {
case zypp::Dep::PROVIDES_e: return "Provides:";
case zypp::Dep::PREREQUIRES_e: return "Pre-requires:";
@@ -1198,7 +1196,7 @@
GtkWidget *child = gtk_event_box_new();
gtk_container_add (GTK_CONTAINER (child), hbox);
- GdkColor *color = &detail_description->style->base [GTK_STATE_NORMAL];
+ GdkColor *color = >k_widget_get_style(detail_description)->base [GTK_STATE_NORMAL];
gtk_widget_modify_bg (child, GTK_STATE_NORMAL, color);
m_scroll = gtk_scrolled_window_new (NULL, NULL);
@@ -1253,7 +1251,10 @@
{
GtkScrolledWindow *_scroll = GTK_SCROLLED_WINDOW (scroll);
GtkAdjustment *adj = gtk_scrolled_window_get_vadjustment (_scroll);
- int height = scroll->allocation.height;
+ GtkAllocation alloc;
+ gtk_widget_get_allocation(scroll, &alloc);
+
+ int height = alloc.height;
gdouble increment;
switch (step) {
case GTK_MOVEMENT_DISPLAY_LINES:
@@ -1263,17 +1264,17 @@
increment = height * 0.9;
break;
case GTK_MOVEMENT_DISPLAY_LINE_ENDS:
- increment = adj->upper - adj->lower;
+ increment = gtk_adjustment_get_upper(adj) - gtk_adjustment_get_lower(adj);
break;
default:
increment = 0.0;
break;
}
- gdouble value = adj->value + (count * increment);
- value = MIN (value, adj->upper - adj->page_size);
- value = MAX (value, adj->lower);
- if (value != adj->value)
+ gdouble value = gtk_adjustment_get_value(adj) + (count * increment);
+ value = MIN (value, gtk_adjustment_get_upper(adj) - gtk_adjustment_get_page_size(adj));
+ value = MAX (value, gtk_adjustment_get_lower(adj));
+ if (value != gtk_adjustment_get_value(adj))
gtk_adjustment_set_value (adj, value);
}
Modified: trunk/gtk/src/pkg/ygtkpkgdetailview.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpkgdetailview.h?…
==============================================================================
--- trunk/gtk/src/pkg/ygtkpkgdetailview.h (original)
+++ trunk/gtk/src/pkg/ygtkpkgdetailview.h Sat Jul 23 07:43:30 2011
@@ -8,7 +8,7 @@
#ifndef YGTK_PKG_DETAIL_VIEW_H
#define YGTK_PKG_DETAIL_VIEW_H
-#include <gtk/gtkwidget.h>
+#include <gtk/gtk.h>
#include "yzyppwrapper.h"
struct YGtkPkgDetailView
Modified: trunk/gtk/src/pkg/ygtkpkgfilterview.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpkgfilterview.h?…
==============================================================================
--- trunk/gtk/src/pkg/ygtkpkgfilterview.h (original)
+++ trunk/gtk/src/pkg/ygtkpkgfilterview.h Sat Jul 23 07:43:30 2011
@@ -16,7 +16,7 @@
#define YGTK_PKG_FILTER_VIEW_H
#include "ygtkpkgquerywidget.h"
-#include <gtk/gtktreestore.h>
+#include <gtk/gtk.h>
struct YGtkPkgFilterModel // abstract
{
Modified: trunk/gtk/src/pkg/ygtkpkghistorydialog.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpkghistorydialog…
==============================================================================
--- trunk/gtk/src/pkg/ygtkpkghistorydialog.cc (original)
+++ trunk/gtk/src/pkg/ygtkpkghistorydialog.cc Sat Jul 23 07:43:30 2011
@@ -504,7 +504,7 @@
gtk_tree_view_get_model (date_view), &iter))
gtk_tree_selection_select_iter (selection, &iter);
- gdk_window_set_cursor (dialog->window, NULL);
+ gdk_window_set_cursor (gtk_widget_get_window(GTK_WIDGET(dialog)), NULL);
return FALSE;
}
@@ -637,7 +637,8 @@
gtk_paned_pack1 (GTK_PANED (hpaned), date_scroll, FALSE, FALSE);
gtk_paned_pack2 (GTK_PANED (hpaned), log_scroll, TRUE, FALSE);
YGUtils::setPaneRelPosition (hpaned, .30);
- gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), hpaned);
+ gtk_widget_set_vexpand (hpaned, TRUE);
+ gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area(GTK_DIALOG (dialog))), hpaned);
gtk_widget_show_all (dialog);
m_dialog = dialog;
@@ -654,7 +655,7 @@
G_CALLBACK (date_selection_changed_cb), log_view);
GdkCursor *cursor = gdk_cursor_new (GDK_WATCH);
- gdk_window_set_cursor (dialog->window, cursor);
+ gdk_window_set_cursor (gtk_widget_get_window(GTK_WIDGET(dialog)), cursor);
gdk_cursor_unref (cursor);
GtkWidget **views = g_new (GtkWidget *, 3);
Modified: trunk/gtk/src/pkg/ygtkpkghistorydialog.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpkghistorydialog…
==============================================================================
--- trunk/gtk/src/pkg/ygtkpkghistorydialog.h (original)
+++ trunk/gtk/src/pkg/ygtkpkghistorydialog.h Sat Jul 23 07:43:30 2011
@@ -9,7 +9,7 @@
#ifndef YGTK_PKG_HISTORY_DIALOG_H
#define YGTK_PKG_HISTORY_DIALOG_H
-#include <gtk/gtkwidget.h>
+#include <gtk/gtk.h>
struct YGtkPkgHistoryDialog
{
Modified: trunk/gtk/src/pkg/ygtkpkglistview.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpkglistview.cc?r…
==============================================================================
--- trunk/gtk/src/pkg/ygtkpkglistview.cc (original)
+++ trunk/gtk/src/pkg/ygtkpkglistview.cc Sat Jul 23 07:43:30 2011
@@ -515,7 +515,7 @@
static void selection_changed_cb (GtkTreeSelection *selection, YGtkPkgListView *pThis)
{
- if (GTK_WIDGET_REALIZED (pThis->impl->view) && pThis->impl->listener)
+ if (gtk_widget_get_realized (pThis->impl->view) && pThis->impl->listener)
pThis->impl->listener->selectionChanged();
}
@@ -742,7 +742,7 @@
gtk_tree_selection_select_path (selection, path);
gtk_tree_path_free (path);
}
- else if (GTK_WIDGET_REALIZED (impl->view))
+ else if (gtk_widget_get_realized (impl->view))
gtk_tree_view_scroll_to_point (GTK_TREE_VIEW (impl->view), -1, 0);
}
Modified: trunk/gtk/src/pkg/ygtkpkglistview.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpkglistview.h?re…
==============================================================================
--- trunk/gtk/src/pkg/ygtkpkglistview.h (original)
+++ trunk/gtk/src/pkg/ygtkpkglistview.h Sat Jul 23 07:43:30 2011
@@ -9,7 +9,7 @@
#define YGTK_PKG_LIST_VIEW_H
#include "yzyppwrapper.h"
-#include <gtk/gtkwidget.h>
+#include <gtk/gtk.h>
enum Property {
INSTALLED_CHECK_PROP, NAME_PROP, ACTION_NAME_PROP, NAME_SUMMARY_PROP,
Modified: trunk/gtk/src/pkg/ygtkpkgmenubar.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpkgmenubar.cc?re…
==============================================================================
--- trunk/gtk/src/pkg/ygtkpkgmenubar.cc (original)
+++ trunk/gtk/src/pkg/ygtkpkgmenubar.cc Sat Jul 23 07:43:30 2011
@@ -450,7 +450,8 @@
struct CheckMenuFlag {
CheckMenuFlag (GtkWidget *menu, const char *text) {
- m_item = gtk_check_menu_item_new_with_mnemonic (text);
+ std::string str (YGUtils::mapKBAccel(text));
+ m_item = gtk_check_menu_item_new_with_mnemonic (str.c_str());
g_object_set_data_full (G_OBJECT (m_item), "this", this, destructor);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), m_item);
}
Modified: trunk/gtk/src/pkg/ygtkpkgmenubar.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpkgmenubar.h?rev…
==============================================================================
--- trunk/gtk/src/pkg/ygtkpkgmenubar.h (original)
+++ trunk/gtk/src/pkg/ygtkpkgmenubar.h Sat Jul 23 07:43:30 2011
@@ -8,7 +8,7 @@
#ifndef YGTK_PKG_MENU_BAR_H
#define YGTK_PKG_MENU_BAR_H
-#include <gtk/gtkwidget.h>
+#include <gtk/gtk.h>
struct YGtkPkgMenuBar
{
Modified: trunk/gtk/src/pkg/ygtkpkgpatternview.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpkgpatternview.h…
==============================================================================
--- trunk/gtk/src/pkg/ygtkpkgpatternview.h (original)
+++ trunk/gtk/src/pkg/ygtkpkgpatternview.h Sat Jul 23 07:43:30 2011
@@ -9,7 +9,7 @@
#define YGTK_PKG_PATTERN_LIST_H
#include "ygtkpkgquerywidget.h"
-#include <gtk/gtkwidget.h>
+#include <gtk/gtk.h>
struct YGtkPkgPatternView : public YGtkPkgQueryWidget
{
Modified: trunk/gtk/src/pkg/ygtkpkgproductdialog.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpkgproductdialog…
==============================================================================
--- trunk/gtk/src/pkg/ygtkpkgproductdialog.cc (original)
+++ trunk/gtk/src/pkg/ygtkpkgproductdialog.cc Sat Jul 23 07:43:30 2011
@@ -98,7 +98,7 @@
sel->candidateObj().isSatisfied() || sel->hasInstalledObj(),
TEXT_COLUMN, text.c_str(), VERSION_COLUMN, version.c_str(),
VENDOR_COLUMN, prod->vendor().c_str(), DESCRIPTION_COLUMN,
- description.c_str(), -1);
+ description.c_str(), -1);
}
GtkWidget *description = ygtk_rich_text_new();
@@ -121,7 +121,7 @@
renderer = gtk_cell_renderer_toggle_new();
column = gtk_tree_view_column_new_with_attributes (
NULL, renderer, "active", INSTALLED_COLUMN, NULL);
- g_object_set (G_OBJECT (renderer), "sensitive", FALSE, NULL);
+ gtk_cell_renderer_set_sensitive(renderer, FALSE);
gtk_tree_view_append_column (tview, column);
renderer = gtk_cell_renderer_text_new();
@@ -167,7 +167,8 @@
gtk_paned_pack1 (GTK_PANED (vpaned), scroll, TRUE, FALSE);
gtk_paned_pack2 (GTK_PANED (vpaned), description_scroll, FALSE, TRUE);
YGUtils::setPaneRelPosition (vpaned, .70);
- gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), vpaned);
+ gtk_widget_set_vexpand (vpaned, TRUE);
+ gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area(GTK_DIALOG (dialog))), vpaned);
gtk_widget_show_all (dialog);
m_dialog = dialog;
Modified: trunk/gtk/src/pkg/ygtkpkgproductdialog.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpkgproductdialog…
==============================================================================
--- trunk/gtk/src/pkg/ygtkpkgproductdialog.h (original)
+++ trunk/gtk/src/pkg/ygtkpkgproductdialog.h Sat Jul 23 07:43:30 2011
@@ -8,7 +8,7 @@
#ifndef YGTK_PKG_PRODUCT_DIALOG_H
#define YGTK_PKG_PRODUCT_DIALOG_H
-#include <gtk/gtkwidget.h>
+#include <gtk/gtk.h>
struct YGtkPkgProductDialog
{
Modified: trunk/gtk/src/pkg/ygtkpkgquerycombo.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpkgquerycombo.cc…
==============================================================================
--- trunk/gtk/src/pkg/ygtkpkgquerycombo.cc (original)
+++ trunk/gtk/src/pkg/ygtkpkgquerycombo.cc Sat Jul 23 07:43:30 2011
@@ -51,7 +51,7 @@
YGtkPkgQueryCombo::YGtkPkgQueryCombo (Factory *factory)
: impl (new Impl (factory))
{
- impl->combo = gtk_combo_box_new_text();
+ impl->combo = gtk_combo_box_text_new();
gtk_combo_box_set_row_separator_func (GTK_COMBO_BOX (impl->combo),
YGUtils::empty_row_is_separator_cb, GINT_TO_POINTER (0), NULL);
g_signal_connect_after (G_OBJECT (impl->combo), "changed",
@@ -70,8 +70,8 @@
void YGtkPkgQueryCombo::add (const char *title)
{
- GtkComboBox *combo = GTK_COMBO_BOX (impl->combo);
- gtk_combo_box_append_text (combo, title);
+ GtkComboBoxText *combo = GTK_COMBO_BOX_TEXT (impl->combo);
+ gtk_combo_box_text_append (combo, NULL, title);
}
void YGtkPkgQueryCombo::setActive (int index)
Modified: trunk/gtk/src/pkg/ygtkpkgquerycombo.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpkgquerycombo.h?…
==============================================================================
--- trunk/gtk/src/pkg/ygtkpkgquerycombo.h (original)
+++ trunk/gtk/src/pkg/ygtkpkgquerycombo.h Sat Jul 23 07:43:30 2011
@@ -10,7 +10,7 @@
#define YGTK_PKG_QUERY_COMBO_H
#include "ygtkpkgquerywidget.h"
-#include <gtk/gtkwidget.h>
+#include <gtk/gtk.h>
struct YGtkPkgQueryCombo : public YGtkPkgQueryWidget
{
Modified: trunk/gtk/src/pkg/ygtkpkgquerywidget.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpkgquerywidget.h…
==============================================================================
--- trunk/gtk/src/pkg/ygtkpkgquerywidget.h (original)
+++ trunk/gtk/src/pkg/ygtkpkgquerywidget.h Sat Jul 23 07:43:30 2011
@@ -8,7 +8,7 @@
#ifndef YGTK_PKG_QUERY_WIDGET_H
#define YGTK_PKG_QUERY_WIDGET_H
-#include <gtk/gtkwidget.h>
+#include <gtk/gtk.h>
#include "yzyppwrapper.h"
struct YGtkPkgQueryWidget
Modified: trunk/gtk/src/pkg/ygtkpkgrpmgroupsview.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpkgrpmgroupsview…
==============================================================================
--- trunk/gtk/src/pkg/ygtkpkgrpmgroupsview.h (original)
+++ trunk/gtk/src/pkg/ygtkpkgrpmgroupsview.h Sat Jul 23 07:43:30 2011
@@ -9,7 +9,7 @@
#define YGTK_PKG_RPM_GROUP_VIEW_H
#include "ygtkpkgquerywidget.h"
-#include <gtk/gtkwidget.h>
+#include <gtk/gtk.h>
struct YGtkPkgRpmGroupsView : public YGtkPkgQueryWidget
{
Modified: trunk/gtk/src/pkg/ygtkpkgsearchentry.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpkgsearchentry.c…
==============================================================================
--- trunk/gtk/src/pkg/ygtkpkgsearchentry.cc (original)
+++ trunk/gtk/src/pkg/ygtkpkgsearchentry.cc Sat Jul 23 07:43:30 2011
@@ -98,13 +98,14 @@
GtkWidget *label = gtk_label_new_with_mnemonic (label_str.c_str());
gtk_label_set_mnemonic_widget (GTK_LABEL (label), impl->entry);
- impl->combo = gtk_combo_box_new_text();
- gtk_combo_box_append_text (GTK_COMBO_BOX (impl->combo), _("Name & Summary"));
- gtk_combo_box_append_text (GTK_COMBO_BOX (impl->combo), _("Description"));
+ impl->combo = gtk_combo_box_text_new();
+ GtkComboBoxText *combot = GTK_COMBO_BOX_TEXT (impl->combo);
+ gtk_combo_box_text_append (combot, 0, _("Name & Summary"));
+ gtk_combo_box_text_append (combot, 0, _("Description"));
if (!YGPackageSelector::get()->onlineUpdateMode()) {
- gtk_combo_box_append_text (GTK_COMBO_BOX (impl->combo), _("File name"));
- gtk_combo_box_append_text (GTK_COMBO_BOX (impl->combo), "RPM Provides");
- gtk_combo_box_append_text (GTK_COMBO_BOX (impl->combo), "RPM Requires");
+ gtk_combo_box_text_append (combot, 0, _("File name"));
+ gtk_combo_box_text_append (combot, 0, "RPM Provides");
+ gtk_combo_box_text_append (combot, 0, "RPM Requires");
}
gtk_combo_box_set_active (GTK_COMBO_BOX (impl->combo), 0);
YGUtils::shrinkWidget (impl->combo);
Modified: trunk/gtk/src/pkg/ygtkpkgstatusbar.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpkgstatusbar.cc?…
==============================================================================
--- trunk/gtk/src/pkg/ygtkpkgstatusbar.cc (original)
+++ trunk/gtk/src/pkg/ygtkpkgstatusbar.cc Sat Jul 23 07:43:30 2011
@@ -19,9 +19,6 @@
#include "yzyppwrapper.h"
#include <gtk/gtk.h>
-static void enlarge_width_size_request_cb (GtkWidget *widget, GtkRequisition *req)
-{ req->width += 4; }
-
struct LastChange {
GtkWidget *hbox, *icon, *text, *undo_button;
@@ -36,8 +33,6 @@
gtk_misc_set_alignment (GTK_MISC (text), 0, .5);
undo_button = gtk_button_new_from_stock (GTK_STOCK_UNDO);
YGUtils::shrinkWidget (undo_button);
- g_signal_connect (G_OBJECT (undo_button), "size-request",
- G_CALLBACK (enlarge_width_size_request_cb), NULL);
g_signal_connect (G_OBJECT (undo_button), "clicked",
G_CALLBACK (undo_clicked_cb), this);
gchar *str = g_strdup_printf ("(<a href=\"more\">%s</a>)", _("view all changes"));
@@ -117,13 +112,16 @@
void set_ellipsize (GtkWidget *label)
{
GtkWidget *hbox = gtk_widget_get_parent (this->hbox);
- if (GTK_WIDGET_REALIZED (hbox)) {
+ if (gtk_widget_get_realized (hbox)) {
gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_NONE);
GtkRequisition req;
gtk_widget_size_request (hbox, &req);
GtkWidget *window = gtk_widget_get_toplevel (hbox);
- bool ellipsize = req.width > window->allocation.width - 10;
+ GtkAllocation allocation;
+ gtk_widget_get_allocation(window, &allocation);
+
+ bool ellipsize = req.width > allocation.width - 10;
PangoEllipsizeMode mode = ellipsize ? PANGO_ELLIPSIZE_MIDDLE : PANGO_ELLIPSIZE_NONE;
gtk_label_set_ellipsize (GTK_LABEL (label), mode);
Modified: trunk/gtk/src/pkg/ygtkpkgstatusbar.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpkgstatusbar.h?r…
==============================================================================
--- trunk/gtk/src/pkg/ygtkpkgstatusbar.h (original)
+++ trunk/gtk/src/pkg/ygtkpkgstatusbar.h Sat Jul 23 07:43:30 2011
@@ -8,7 +8,7 @@
#ifndef YGTK_PKG_STATUS_BAR_H
#define YGTK_PKG_STATUS_BAR_H
-#include <gtk/gtkwidget.h>
+#include <gtk/gtk.h>
struct YGtkPkgUndoList;
Modified: trunk/gtk/src/pkg/ygtkpkgundolist.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpkgundolist.cc?r…
==============================================================================
--- trunk/gtk/src/pkg/ygtkpkgundolist.cc (original)
+++ trunk/gtk/src/pkg/ygtkpkgundolist.cc Sat Jul 23 07:43:30 2011
@@ -307,7 +307,8 @@
if (onApply)
gtk_box_pack_start (GTK_BOX (vbox), create_close_when_done_check(), FALSE, TRUE, 0);
gtk_widget_show (vbox);
- gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), vbox);
+ gtk_widget_set_vexpand (vbox, TRUE);
+ gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area(GTK_DIALOG (dialog))), vbox);
int ret = gtk_dialog_run (GTK_DIALOG (dialog));
if (ret == 1)
Modified: trunk/gtk/src/pkg/ygtkpkgvestigialdialog.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpkgvestigialdial…
==============================================================================
--- trunk/gtk/src/pkg/ygtkpkgvestigialdialog.h (original)
+++ trunk/gtk/src/pkg/ygtkpkgvestigialdialog.h Sat Jul 23 07:43:30 2011
@@ -8,7 +8,7 @@
#ifndef YGTK_PKG_VESTIGIAL_DIALOG_H
#define YGTK_PKG_VESTIGIAL_DIALOG_H
-#include <gtk/gtkwidget.h>
+#include <gtk/gtk.h>
struct YGtkPkgVestigialDialog
{
Modified: trunk/gtk/src/pkg/ygtktreemodel.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtktreemodel.h?rev=…
==============================================================================
--- trunk/gtk/src/pkg/ygtktreemodel.h (original)
+++ trunk/gtk/src/pkg/ygtktreemodel.h Sat Jul 23 07:43:30 2011
@@ -8,7 +8,7 @@
#ifndef YGTK_TREE_MODEL_H
#define YGTK_TREE_MODEL_H
-#include <gtk/gtktreemodel.h>
+#include <gtk/gtk.h>
struct YGtkTreeModel
{
Modified: trunk/gtk/src/ygdkmngloader.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygdkmngloader.c?rev=6496…
==============================================================================
--- trunk/gtk/src/ygdkmngloader.c (original)
+++ trunk/gtk/src/ygdkmngloader.c Sat Jul 23 07:43:30 2011
@@ -132,8 +132,7 @@
{
gboolean error = FALSE;
FILE *file = fopen (filename, "rb");
- if (!file)
- {
+ if (!file) {
SET_ERROR ("Could not open specified file")
return NULL;
}
@@ -147,8 +146,7 @@
fileno (file), 0);
if (data == MAP_FAILED)
SET_ERROR ("Could not map file")
- else
- {
+ else {
mng_pixbuf = ygdk_mng_pixbuf_new_from_data (data, file_size, error_msg);
munmap (data, file_size);
}
@@ -162,8 +160,7 @@
DataStream data = data_stream_constructor (raw_data, size);
gboolean error = FALSE;
- if (!read_signature (&data))
- {
+ if (!read_signature (&data)) {
SET_ERROR ("Not a MNG file")
return NULL;
}
@@ -179,8 +176,7 @@
do {
error = !read_uint32 (&data, &chunk_size);
error = error || !read_uint32 (&data, &chunk_id);
- if (error)
- {
+ if (error) {
SET_ERROR ("Unexpected end of file on new chunk")
break;
}
Modified: trunk/gtk/src/ygtkbargraph.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkbargraph.c?rev=64969…
==============================================================================
--- trunk/gtk/src/ygtkbargraph.c (original)
+++ trunk/gtk/src/ygtkbargraph.c Sat Jul 23 07:43:30 2011
@@ -20,10 +20,21 @@
ygtk_bar_graph_set_style (bar, TRUE);
}
-static void ygtk_bar_graph_size_request (GtkWidget *widget, GtkRequisition *requisition)
+static void
+ygtk_bar_graph_get_preferred_height (GtkWidget *widget,
+ gint *minimal_height,
+ gint *natural_height)
{
- GTK_WIDGET_CLASS (ygtk_bar_graph_parent_class)->size_request (widget, requisition);
- requisition->height += 18; // give room for the labels
+ GTK_WIDGET_CLASS (ygtk_bar_graph_parent_class)->get_preferred_height (widget, minimal_height, natural_height);
+ *natural_height = *minimal_height = *minimal_height + 18; // give room for the labels
+}
+
+static void
+ygtk_bar_graph_get_preferred_width (GtkWidget *widget,
+ gint *minimal_width,
+ gint *natural_width)
+{
+ GTK_WIDGET_CLASS (ygtk_bar_graph_parent_class)->get_preferred_width (widget, minimal_width, natural_width);
}
GtkWidget *ygtk_bar_graph_new (void)
@@ -33,7 +44,7 @@
void ygtk_bar_graph_create_entries (YGtkBarGraph *bar, guint entries)
{
- YGtkRatioBox *box = YGTK_RATIO_BOX (GTK_BIN (bar)->child);
+ YGtkRatioBox *box = YGTK_RATIO_BOX (gtk_bin_get_child(GTK_BIN (bar)));
// Remove the ones in excess
guint i;
@@ -56,7 +67,7 @@
static GtkWidget *ygtk_bar_graph_get_label (YGtkBarGraph *bar, int index, GtkWidget **b)
{
- YGtkRatioBox *hbox = YGTK_RATIO_BOX (GTK_BIN (bar)->child);
+ YGtkRatioBox *hbox = YGTK_RATIO_BOX (gtk_bin_get_child(GTK_BIN (bar)));
GtkWidget *box = ((YGtkRatioBoxChild *) g_list_nth_data (hbox->children, index))->widget;
if (b) *b = box;
return gtk_bin_get_child (GTK_BIN (box));
@@ -92,7 +103,7 @@
// Set proportion
gtk_widget_set_size_request (box, 0, -1);
- YGtkRatioBox *hbox = YGTK_RATIO_BOX (GTK_BIN (bar)->child);
+ YGtkRatioBox *hbox = YGTK_RATIO_BOX (gtk_bin_get_child(GTK_BIN (bar)));
ygtk_ratio_box_set_child_packing (hbox, box, MAX (value, 1));
// Set background color
@@ -129,7 +140,7 @@
YGtkColoredLabel *color_label = YGTK_COLORED_LABEL (label);
const guint *color = palette [index % G_N_ELEMENTS (palette)];
- GdkColor gcolor = { 0, color[0] << 8, color[1] << 8, color[2] << 8 };
+ GdkRGBA gcolor = { color[0] / 255., color[1] / 255., color[2] / 255., 0 };
ygtk_colored_label_set_background (color_label, &gcolor);
}
@@ -140,13 +151,13 @@
gtk_frame_set_shadow_type (GTK_FRAME (bar), shadow);
}
-void ygtk_bar_graph_customize_bg (YGtkBarGraph *bar, int index, GdkColor *color)
+void ygtk_bar_graph_customize_bg (YGtkBarGraph *bar, int index, GdkRGBA *color)
{
GtkWidget *label = ygtk_bar_graph_get_label (bar, index, NULL);
ygtk_colored_label_set_background (YGTK_COLORED_LABEL (label), color);
}
-void ygtk_bar_graph_customize_fg (YGtkBarGraph *bar, int index, GdkColor *color)
+void ygtk_bar_graph_customize_fg (YGtkBarGraph *bar, int index, GdkRGBA *color)
{
GtkWidget *label = ygtk_bar_graph_get_label (bar, index, NULL);
ygtk_colored_label_set_foreground (YGTK_COLORED_LABEL (label), color);
@@ -157,7 +168,8 @@
ygtk_bar_graph_parent_class = g_type_class_peek_parent (klass);
GtkWidgetClass* widget_class = GTK_WIDGET_CLASS (klass);
- widget_class->size_request = ygtk_bar_graph_size_request;
+ widget_class->get_preferred_width = ygtk_bar_graph_get_preferred_width;
+ widget_class->get_preferred_height = ygtk_bar_graph_get_preferred_height;
}
//** YGtkColoredLabel
@@ -172,55 +184,49 @@
static inline double pixel_clamp (double val)
{ return MAX (0, MIN (1, val)); }
-static gboolean ygtk_colored_label_expose_event (GtkWidget *widget, GdkEventExpose *event)
+static gboolean ygtk_colored_label_on_draw (GtkWidget *widget, cairo_t *cr)
{
- GtkAllocation *alloc = &widget->allocation;
+ GtkStyleContext *ctx;
+ ctx = gtk_widget_get_style_context(widget);
+
+ GdkRGBA color;
+ gtk_style_context_get_background_color(ctx, GTK_STATE_NORMAL, &color);
+
+ cairo_save(cr);
+ int width = gtk_widget_get_allocated_width (widget);
+ int height = gtk_widget_get_allocated_height (widget);
+ cairo_scale (cr, width, height);
- GdkColor *bg_color = &widget->style->bg[GTK_STATE_NORMAL];
- double red = (bg_color->red >> 8) / 255.;
- double green = (bg_color->green >> 8) / 255.;
- double blue = (bg_color->blue >> 8) / 255.;
-
- cairo_t *cr = gdk_cairo_create (event->window);
- cairo_translate (cr, alloc->x, alloc->y);
- cairo_scale (cr, alloc->width, alloc->height);
-
- double x, y, w, h;
- x = alloc->x;
- y = alloc->y;
- w = alloc->width;
- h = alloc->height;
cairo_pattern_t *grad = cairo_pattern_create_linear (0, 0, 0, 1);
- cairo_pattern_add_color_stop_rgba (grad, 0, pixel_clamp (red+.3), pixel_clamp (green+.3), pixel_clamp (blue+.3), 1);
- cairo_pattern_add_color_stop_rgba (grad, 0.70, red, green, blue, 1);
- cairo_pattern_add_color_stop_rgba (grad, 1, pixel_clamp (red-.2), pixel_clamp (green-.2), pixel_clamp (blue-.2), 1);
+ cairo_pattern_add_color_stop_rgba (grad, 0, pixel_clamp (color.red+.3), pixel_clamp (color.green+.3), pixel_clamp (color.blue+.3), 1);
+ cairo_pattern_add_color_stop_rgba (grad, 0.70, color.red, color.green, color.blue, 1);
+ cairo_pattern_add_color_stop_rgba (grad, 1, pixel_clamp (color.red-.2), pixel_clamp (color.green-.2), pixel_clamp (color.blue-.2), 1);
cairo_rectangle (cr, 0, 0, 1, 1);
cairo_set_source (cr, grad);
cairo_fill (cr);
cairo_pattern_destroy (grad);
- cairo_destroy (cr);
-
- GTK_WIDGET_CLASS (ygtk_colored_label_parent_class)->expose_event (widget, event);
+ cairo_restore(cr);
+ GTK_WIDGET_CLASS (ygtk_colored_label_parent_class)->draw (widget, cr);
return FALSE;
}
GtkWidget *ygtk_colored_label_new (void)
{ return g_object_new (YGTK_TYPE_COLORED_LABEL, NULL); }
-void ygtk_colored_label_set_background (YGtkColoredLabel *label, GdkColor *color)
-{ gtk_widget_modify_bg (GTK_WIDGET (label), GTK_STATE_NORMAL, color); }
+void ygtk_colored_label_set_background (YGtkColoredLabel *label, GdkRGBA *color)
+{ gtk_widget_override_background_color (GTK_WIDGET (label), GTK_STATE_NORMAL, color); }
-void ygtk_colored_label_set_foreground (YGtkColoredLabel *label, GdkColor *color)
-{ gtk_widget_modify_fg (GTK_WIDGET (label), GTK_STATE_NORMAL, color); }
+void ygtk_colored_label_set_foreground (YGtkColoredLabel *label, GdkRGBA *color)
+{ gtk_widget_override_color (GTK_WIDGET (label), GTK_STATE_NORMAL, color); }
static void ygtk_colored_label_class_init (YGtkColoredLabelClass *klass)
{
ygtk_colored_label_parent_class = g_type_class_peek_parent (klass);
GtkWidgetClass* widget_class = GTK_WIDGET_CLASS (klass);
- widget_class->expose_event = ygtk_colored_label_expose_event;
+ widget_class->draw = ygtk_colored_label_on_draw;
}
Modified: trunk/gtk/src/ygtkbargraph.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkbargraph.h?rev=64969…
==============================================================================
--- trunk/gtk/src/ygtkbargraph.h (original)
+++ trunk/gtk/src/ygtkbargraph.h Sat Jul 23 07:43:30 2011
@@ -9,7 +9,7 @@
#ifndef YGTK_BAR_GRAPH_H
#define YGTK_BAR_GRAPH_H
-#include <gtk/gtkframe.h>
+#include <gtk/gtk.h>
G_BEGIN_DECLS
#define YGTK_TYPE_BAR_GRAPH (ygtk_bar_graph_get_type ())
@@ -46,8 +46,8 @@
void ygtk_bar_graph_setup_entry (YGtkBarGraph *bar, int index, const gchar *label_entry, int value);
void ygtk_bar_graph_set_style (YGtkBarGraph *bar, gboolean flat);
-void ygtk_bar_graph_customize_bg (YGtkBarGraph *bar, int index, GdkColor *color);
-void ygtk_bar_graph_customize_fg (YGtkBarGraph *bar, int index, GdkColor *color);
+void ygtk_bar_graph_customize_bg (YGtkBarGraph *bar, int index, GdkRGBA *color);
+void ygtk_bar_graph_customize_fg (YGtkBarGraph *bar, int index, GdkRGBA *color);
G_END_DECLS
#endif /*YGTK_BAR_GRAPH_H*/
@@ -55,7 +55,6 @@
#ifndef YGTK_COLORED_LABEL_H
#define YGTK_COLORED_LABEL_H
-#include <gtk/gtklabel.h>
G_BEGIN_DECLS
/* YGtkColoredLabel is a GtkLabel where gtk_modify_bg() can be used. It also
@@ -88,8 +87,8 @@
// A convenience function (you may use gtk_widget_modify_fg() and
// gtk_widget_modify_bg() instead), where colors range is [0, 255]
-void ygtk_colored_label_set_foreground (YGtkColoredLabel *label, GdkColor *color);
-void ygtk_colored_label_set_background (YGtkColoredLabel *label, GdkColor *color);
+void ygtk_colored_label_set_foreground (YGtkColoredLabel *label, GdkRGBA *color);
+void ygtk_colored_label_set_background (YGtkColoredLabel *label, GdkRGBA *color);
G_END_DECLS
#endif /*YGTK_COLORED_LABEL*/
Modified: trunk/gtk/src/ygtkfieldentry.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkfieldentry.c?rev=649…
==============================================================================
--- trunk/gtk/src/ygtkfieldentry.c (original)
+++ trunk/gtk/src/ygtkfieldentry.c Sat Jul 23 07:43:30 2011
@@ -184,7 +184,7 @@
filter_entry_signal = g_signal_new ("field_entry_changed",
G_OBJECT_CLASS_TYPE (klass), G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
G_STRUCT_OFFSET (YGtkFieldEntryClass, filter_entry_changed),
- NULL, NULL, gtk_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
+ NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
}
gboolean ygtk_field_entry_set_focus (YGtkFieldEntry *fields)
Modified: trunk/gtk/src/ygtkfieldentry.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkfieldentry.h?rev=649…
==============================================================================
--- trunk/gtk/src/ygtkfieldentry.h (original)
+++ trunk/gtk/src/ygtkfieldentry.h Sat Jul 23 07:43:30 2011
@@ -12,8 +12,7 @@
#ifndef YGTK_FIELD_ENTRY_H
#define YGTK_FIELD_ENTRY_H
-#include <gtk/gtkhbox.h>
-#include <gtk/gtkentry.h>
+#include <gtk/gtk.h>
G_BEGIN_DECLS
#define YGTK_TYPE_FIELD_ENTRY (ygtk_field_entry_get_type ())
@@ -43,7 +42,7 @@
GtkWidget* ygtk_field_entry_new (void);
GType ygtk_field_entry_get_type (void) G_GNUC_CONST;
-// if this is the first field, separator will be ignored.
+// if this is the first field, separator will be ignored.
guint ygtk_field_entry_add_field (YGtkFieldEntry *entry, gchar separator);
// max_length can be 0 to disable it. valids_chars can be NULL to disable it.
void ygtk_field_entry_setup_field (YGtkFieldEntry *entry, guint index,
Modified: trunk/gtk/src/ygtkfixed.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkfixed.c?rev=64969&r1…
==============================================================================
--- trunk/gtk/src/ygtkfixed.c (original)
+++ trunk/gtk/src/ygtkfixed.c Sat Jul 23 07:43:30 2011
@@ -14,14 +14,15 @@
static void ygtk_fixed_init (YGtkFixed *fixed)
{
- GTK_WIDGET_SET_FLAGS (fixed, GTK_NO_WINDOW);
+ gtk_widget_set_has_window(GTK_WIDGET(fixed), FALSE);
gtk_widget_set_redraw_on_allocate (GTK_WIDGET (fixed), FALSE);
}
-void ygtk_fixed_setup (YGtkFixed *fixed, YGtkPreferredSize cb1, YGtkSetSize cb2, gpointer data)
+void ygtk_fixed_setup (YGtkFixed *fixed, YGtkPreferredWidth cb1, YGtkPreferredHeight cb2, YGtkSetSize cb3, gpointer data)
{
- fixed->preferred_size_cb = cb1;
- fixed->set_size_cb = cb2;
+ fixed->preferred_width_cb = cb1;
+ fixed->preferred_height_cb = cb2;
+ fixed->set_size_cb = cb3;
fixed->data = data;
}
@@ -68,7 +69,7 @@
for (i = fixed->children; i; i = i->next) {
YGtkFixedChild *child = i->data;
if (child->widget == widget) {
- gboolean was_visible = GTK_WIDGET_VISIBLE (widget);
+ gboolean was_visible = gtk_widget_get_visible (widget);
gtk_widget_unparent (widget);
fixed->children = g_slist_delete_link (fixed->children, i);
g_free (child);
@@ -92,12 +93,24 @@
}
}
-static void ygtk_fixed_size_request (GtkWidget *widget, GtkRequisition *requisition)
+static void
+ygtk_fixed_get_preferred_width (GtkWidget *widget,
+ gint *minimum_width,
+ gint *natural_width)
{
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);
+ *natural_width = *minimum_width =
+ fixed->preferred_width_cb (fixed, fixed->data);
+}
+
+static void
+ygtk_fixed_get_preferred_height (GtkWidget *widget,
+ gint *minimum_height,
+ gint *natural_height)
+{
+ YGtkFixed *fixed = YGTK_FIXED (widget);
+ *natural_height = *minimum_height =
+ fixed->preferred_height_cb (fixed, fixed->data);
}
static void ygtk_fixed_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
@@ -134,7 +147,8 @@
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->get_preferred_width = ygtk_fixed_get_preferred_width;
+ widget_class->get_preferred_height = ygtk_fixed_get_preferred_height;
widget_class->size_allocate = ygtk_fixed_size_allocate;
}
Modified: trunk/gtk/src/ygtkfixed.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkfixed.h?rev=64969&r1…
==============================================================================
--- trunk/gtk/src/ygtkfixed.h (original)
+++ trunk/gtk/src/ygtkfixed.h Sat Jul 23 07:43:30 2011
@@ -8,7 +8,7 @@
#ifndef YGTK_FIXED_H
#define YGTK_FIXED_H
-#include <gtk/gtkcontainer.h>
+#include <gtk/gtk.h>
G_BEGIN_DECLS
#define YGTK_TYPE_FIXED (ygtk_fixed_get_type ())
@@ -26,7 +26,8 @@
typedef struct _YGtkFixed YGtkFixed;
typedef struct _YGtkFixedClass YGtkFixedClass;
-typedef void (*YGtkPreferredSize) (YGtkFixed *, gint *, gint *, gpointer);
+typedef gint (*YGtkPreferredWidth) (YGtkFixed *, gpointer);
+typedef gint (*YGtkPreferredHeight) (YGtkFixed *, gpointer);
typedef void (*YGtkSetSize) (YGtkFixed *, gint, gint, gpointer);
struct _YGtkFixed
@@ -34,7 +35,8 @@
GtkContainer parent;
// private (read-only):
GSList *children;
- YGtkPreferredSize preferred_size_cb;
+ YGtkPreferredWidth preferred_width_cb;
+ YGtkPreferredHeight preferred_height_cb;
YGtkSetSize set_size_cb;
gpointer data;
};
@@ -54,7 +56,7 @@
GType ygtk_fixed_get_type (void) G_GNUC_CONST;
-void ygtk_fixed_setup (YGtkFixed *fixed, YGtkPreferredSize cb1, YGtkSetSize cb2, gpointer data);
+void ygtk_fixed_setup (YGtkFixed *fixed, YGtkPreferredWidth cb1, YGtkPreferredHeight cb2, YGtkSetSize cb3, 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);
Modified: trunk/gtk/src/ygtkhtmlwrap.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkhtmlwrap.c?rev=64969…
==============================================================================
--- trunk/gtk/src/ygtkhtmlwrap.c (original)
+++ trunk/gtk/src/ygtkhtmlwrap.c Sat Jul 23 07:43:30 2011
@@ -6,12 +6,11 @@
// check the header file for information about this widget
#include <config.h>
-#include <gtk/gtkversion.h>
+#include <gtk/gtk.h>
#include <string.h>
#include "ygtkhtmlwrap.h"
// ygutils
-#include <gtk/gtktextview.h>
void ygutils_scrollAdj (GtkAdjustment *vadj, gboolean top);
GtkWidget *ygtk_html_wrap_new (void)
@@ -313,7 +312,7 @@
void ygtk_html_wrap_scroll (GtkWidget *widget, gboolean top)
{
- ygutils_scrollAdj (GTK_TEXT_VIEW (widget)->vadjustment, top);
+ ygutils_scrollAdj (gtk_text_view_get_vadjustment(GTK_TEXT_VIEW (widget)), top);
}
gboolean ygtk_html_wrap_search (GtkWidget *widget, const gchar *text)
Modified: trunk/gtk/src/ygtkhtmlwrap.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkhtmlwrap.h?rev=64969…
==============================================================================
--- trunk/gtk/src/ygtkhtmlwrap.h (original)
+++ trunk/gtk/src/ygtkhtmlwrap.h Sat Jul 23 07:43:30 2011
@@ -11,7 +11,7 @@
#ifndef YGTK_HTML_WRAP_H
#define YGTK_HTML_WRAP_H
-#include <gtk/gtkwidget.h>
+#include <gtk/gtk.h>
G_BEGIN_DECLS
GtkWidget *ygtk_html_wrap_new (void);
Modified: trunk/gtk/src/ygtkimage.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkimage.c?rev=64969&r1…
==============================================================================
--- trunk/gtk/src/ygtkimage.c (original)
+++ trunk/gtk/src/ygtkimage.c Sat Jul 23 07:43:30 2011
@@ -8,7 +8,7 @@
#include <config.h>
#include "ygdkmngloader.h"
#include "ygtkimage.h"
-#include <gtk/gtkiconfactory.h>
+#include <gtk/gtk.h>
G_DEFINE_TYPE (YGtkImage, ygtk_image, GTK_TYPE_DRAWING_AREA)
@@ -35,14 +35,14 @@
}
}
-static void ygtk_image_destroy (GtkObject *object)
+static void ygtk_image_destroy (GtkWidget *widget)
{
- YGtkImage *image = YGTK_IMAGE (object);
+ YGtkImage *image = YGTK_IMAGE (widget);
if (image->alt_text)
g_free (image->alt_text);
image->alt_text = NULL;
ygtk_image_free_pixbuf (image);
- GTK_OBJECT_CLASS (ygtk_image_parent_class)->destroy (object);
+ GTK_WIDGET_CLASS (ygtk_image_parent_class)->destroy (widget);
}
static void ygtk_image_set_pixbuf (YGtkImage *image, GdkPixbuf *pixbuf, const char *error_msg)
@@ -143,8 +143,8 @@
GError *error = 0;
if (anim && ygdk_mng_pixbuf_is_data_mng (data, data_size)) {
GdkPixbufAnimation *pixbuf;
- pixbuf = ygdk_mng_pixbuf_new_from_data (data, data_size, &error);
- ygtk_image_set_animation (image, pixbuf, error ? error->message : "(undefined)");
+ pixbuf = ygdk_mng_pixbuf_new_from_data (data, data_size, &error);
+ ygtk_image_set_animation (image, pixbuf, error ? error->message : "(undefined)");
}
else {
image->animated = anim;
@@ -190,6 +190,26 @@
requisition->height = height;
}
+static void
+ygtk_image_get_preferred_width (GtkWidget *widget,
+ gint *minimal_width,
+ gint *natural_width)
+{
+ GtkRequisition requisition;
+ ygtk_image_size_request (widget, &requisition);
+ *minimal_width = *natural_width = requisition.width;
+}
+
+static void
+ygtk_image_get_preferred_height (GtkWidget *widget,
+ gint *minimal_height,
+ gint *natural_height)
+{
+ GtkRequisition requisition;
+ ygtk_image_size_request (widget, &requisition);
+ *minimal_height = *natural_height = requisition.height;
+}
+
static GdkPixbuf *ygtk_image_render_state (GtkWidget *widget, GdkPixbuf *pixbuf)
{
// as in GtkImage
@@ -198,21 +218,19 @@
gtk_icon_source_set_pixbuf (source, pixbuf);
gtk_icon_source_set_size (source, GTK_ICON_SIZE_SMALL_TOOLBAR);
gtk_icon_source_set_size_wildcarded (source, FALSE);
- rendered = gtk_style_render_icon (widget->style, source,
- gtk_widget_get_direction (widget), GTK_WIDGET_STATE (widget),
- /* arbitrary */ (GtkIconSize)-1, widget, "gtk-image");
+ rendered = gtk_render_icon_pixbuf (gtk_widget_get_style_context(widget), source, (GtkIconSize)-1);
gtk_icon_source_free (source);
return rendered;
}
-static gboolean ygtk_image_expose_event (GtkWidget *widget, GdkEventExpose *event)
+static gboolean ygtk_image_draw_event (GtkWidget *widget, cairo_t *cr)
{
YGtkImage *image = YGTK_IMAGE (widget);
- int width, height;
- width = widget->allocation.width;
- height = widget->allocation.height;
- cairo_t *cr = gdk_cairo_create (widget->window);
+ GtkRequisition req;
+ gtk_widget_get_preferred_size (widget, &req, NULL);
+ int width = gtk_widget_get_allocated_width(widget);
+ int height = gtk_widget_get_allocated_height(widget);
if (!image->loaded) {
if (image->alt_text) {
@@ -221,15 +239,14 @@
layout = gtk_widget_create_pango_layout (widget, image->alt_text);
int x, y;
- x = (width - widget->requisition.width) / 2;
- y = (height - widget->requisition.height) / 2;
+ x = (width - req.width) / 2;
+ y = (height - req.height) / 2;
cairo_move_to (cr, x, y);
pango_cairo_show_layout (cr, layout);
g_object_unref (layout);
}
- cairo_destroy (cr);
return FALSE;
}
@@ -239,13 +256,13 @@
else
pixbuf = image->pixbuf;
- gboolean needs_transform = GTK_WIDGET_STATE (widget) != GTK_STATE_NORMAL;
+ gboolean needs_transform = gtk_widget_get_state (widget) != GTK_STATE_NORMAL;
if (needs_transform)
pixbuf = ygtk_image_render_state (widget, pixbuf);
int x = 0, y = 0;
if (image->align == CENTER_IMAGE_ALIGN) {
- x = (width - widget->requisition.width) / 2;
- y = (height - widget->requisition.height) / 2;
+ x = (width - req.width) / 2;
+ y = (height - req.height) / 2;
}
gdk_cairo_set_source_pixbuf (cr, pixbuf, x, y);
@@ -270,7 +287,6 @@
cairo_rectangle (cr, x, y, width, height);
cairo_fill (cr);
- cairo_destroy (cr);
if (needs_transform)
g_object_unref (G_OBJECT (pixbuf));
return FALSE;
@@ -284,10 +300,9 @@
static void ygtk_image_class_init (YGtkImageClass *klass)
{
GtkWidgetClass* widget_class = GTK_WIDGET_CLASS (klass);
- widget_class->expose_event = ygtk_image_expose_event;
- widget_class->size_request = ygtk_image_size_request;
-
- GtkObjectClass *gtkobject_class = GTK_OBJECT_CLASS (klass);
- gtkobject_class->destroy = ygtk_image_destroy;
+ widget_class->draw = ygtk_image_draw_event;
+ widget_class->get_preferred_width = ygtk_image_get_preferred_width;
+ widget_class->get_preferred_height = ygtk_image_get_preferred_height;
+ widget_class->destroy = ygtk_image_destroy;
}
Modified: trunk/gtk/src/ygtkimage.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkimage.h?rev=64969&r1…
==============================================================================
--- trunk/gtk/src/ygtkimage.h (original)
+++ trunk/gtk/src/ygtkimage.h Sat Jul 23 07:43:30 2011
@@ -10,8 +10,8 @@
#ifndef YGTK_IMAGE_H
#define YGTK_IMAGE_H
-#include <gtk/gtkdrawingarea.h>
-#include <gdk/gdkpixbuf.h>
+#include <gtk/gtk.h>
+#include <gdk/gdk.h>
G_BEGIN_DECLS
@@ -68,7 +68,7 @@
void ygtk_image_set_from_pixbuf (YGtkImage *image, GdkPixbuf *pixbuf);
void ygtk_image_set_props (YGtkImage *image, YGtkImageAlign align, const gchar *alt_text);
-// as we don't have a window,
+// as we don't have a window,
G_END_DECLS
Modified: trunk/gtk/src/ygtklinklabel.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtklinklabel.c?rev=6496…
==============================================================================
--- trunk/gtk/src/ygtklinklabel.c (original)
+++ trunk/gtk/src/ygtklinklabel.c Sat Jul 23 07:43:30 2011
@@ -16,17 +16,19 @@
static void ygtk_link_label_init (YGtkLinkLabel *label)
{
- GTK_WIDGET_SET_FLAGS (label, GTK_NO_WINDOW);
+ gtk_widget_set_has_window(GTK_WIDGET(label), FALSE);
}
static void ygtk_link_label_realize (GtkWidget *widget)
{
GTK_WIDGET_CLASS (ygtk_link_label_parent_class)->realize (widget);
GdkWindowAttr attributes;
- attributes.x = widget->allocation.x;
- attributes.y = widget->allocation.y;
- attributes.width = widget->allocation.width;
- attributes.height = widget->allocation.height;
+ GtkAllocation alloc;
+ gtk_widget_get_allocation(widget, &alloc);
+ attributes.x = alloc.x;
+ attributes.y = alloc.y;
+ attributes.width = alloc.width;
+ attributes.height = alloc.height;
attributes.window_type = GDK_WINDOW_CHILD;
attributes.wclass = GDK_INPUT_OUTPUT;
attributes.event_mask = gtk_widget_get_events (widget) |
@@ -36,12 +38,11 @@
gtk_widget_get_display (widget), GDK_HAND2);
YGtkLinkLabel *label = YGTK_LINK_LABEL (widget);
- label->link_window = gdk_window_new (widget->window, &attributes, attributes_mask);
+ label->link_window = gdk_window_new (gtk_widget_get_window(widget), &attributes, attributes_mask);
gdk_window_set_user_data (label->link_window, widget);
GdkColor white = { 0, 0xffff, 0xffff, 0xffff };
- gdk_rgb_find_color (gtk_widget_get_colormap (widget), &white);
gdk_window_set_background (label->link_window, &white);
- gdk_cursor_unref (attributes.cursor);
+ g_object_unref (G_OBJECT(attributes.cursor));
}
static void ygtk_link_label_unrealize (GtkWidget *widget)
@@ -108,13 +109,15 @@
YGtkLinkLabel *label = YGTK_LINK_LABEL (widget);
ygtk_link_label_ensure_layout (label);
requisition->width = requisition->height = 0;
+ GtkStyleContext *style_ctx;
+ style_ctx = gtk_widget_get_style_context(widget);
// if (label->text && *label->text)
{
PangoContext *context;
PangoFontMetrics *metrics;
gint ascent, descent;
context = pango_layout_get_context (label->layout);
- metrics = pango_context_get_metrics (context, widget->style->font_desc,
+ metrics = pango_context_get_metrics (context, gtk_style_context_get_font(style_ctx, GTK_STATE_FLAG_NORMAL),
pango_context_get_language (context));
ascent = pango_font_metrics_get_ascent (metrics);
descent = pango_font_metrics_get_descent (metrics);
@@ -123,6 +126,26 @@
}
}
+static void
+ygtk_link_label_get_preferred_width (GtkWidget *widget,
+ gint *minimal_width,
+ gint *natural_width)
+{
+ GtkRequisition requisition;
+ ygtk_link_label_size_request (widget, &requisition);
+ *minimal_width = *natural_width = requisition.width;
+}
+
+static void
+ygtk_link_label_get_preferred_height (GtkWidget *widget,
+ gint *minimal_height,
+ gint *natural_height)
+{
+ GtkRequisition requisition;
+ ygtk_link_label_size_request (widget, &requisition);
+ *minimal_height = *natural_height = requisition.height;
+}
+
#define SPACING 4
static void ygtk_link_label_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
@@ -158,29 +181,27 @@
}
}
-static gboolean ygtk_link_label_expose_event (GtkWidget *widget, GdkEventExpose *event)
+static gboolean ygtk_link_label_on_draw (GtkWidget *widget, cairo_t *cr)
{
YGtkLinkLabel *label = YGTK_LINK_LABEL (widget);
ygtk_link_label_ensure_layout (label);
- gint x = 0, y = 0;
- PangoLayout *layout = 0;
- if (event->window == widget->window) {
+ GtkStyleContext *style = gtk_widget_get_style_context(widget);
+ if (gtk_cairo_should_draw_window(cr, gtk_widget_get_window(widget))) {
+ gint x = 0;
+ gint width = gtk_widget_get_allocated_width (widget);
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) {
PangoRectangle extent;
pango_layout_get_extents (label->layout, NULL, &extent);
- x = widget->allocation.width - extent.width/PANGO_SCALE;
+ x = width - extent.width/PANGO_SCALE;
}
- x += widget->allocation.x;
- y += widget->allocation.y;
- layout = label->layout;
- }
- else if (event->window == label->link_window)
- layout = label->link_layout;
-
- if (layout)
- gtk_paint_layout (widget->style, event->window, GTK_WIDGET_STATE (widget),
- FALSE, &event->area, widget, "label", x, y, layout);
+ gtk_render_layout (style, cr, x, 0, label->layout);
+ }
+
+ if (gtk_cairo_should_draw_window(cr, label->link_window)) {
+ gtk_cairo_transform_to_window (cr, widget, label->link_window);
+ gtk_render_layout (style, cr, 0, 0, label->link_layout);
+ }
return FALSE;
}
@@ -190,8 +211,8 @@
return TRUE;
}
-void ygtk_link_label_set_text (YGtkLinkLabel *label, const gchar *text, const gchar *link,
- gboolean link_always_visible)
+void ygtk_link_label_set_text (YGtkLinkLabel *label,
+ const gchar *text, const gchar *link, gboolean link_always_visible)
{
g_free (label->text);
label->text = g_strdup (text);
@@ -219,9 +240,12 @@
widget_class->realize = ygtk_link_label_realize;
widget_class->unrealize = ygtk_link_label_unrealize;
widget_class->map = ygtk_link_label_map;
- widget_class->size_request = ygtk_link_label_size_request;
+
+ widget_class->get_preferred_height = ygtk_link_label_get_preferred_height;
+ widget_class->get_preferred_width = ygtk_link_label_get_preferred_width;
+
widget_class->size_allocate = ygtk_link_label_size_allocate;
- widget_class->expose_event = ygtk_link_label_expose_event;
+ widget_class->draw = ygtk_link_label_on_draw;
widget_class->button_press_event = ygtk_link_label_button_press_event;
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
Modified: trunk/gtk/src/ygtklinklabel.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtklinklabel.h?rev=6496…
==============================================================================
--- trunk/gtk/src/ygtklinklabel.h (original)
+++ trunk/gtk/src/ygtklinklabel.h Sat Jul 23 07:43:30 2011
@@ -12,7 +12,7 @@
#ifndef YGTK_LINK_LABEL_H
#define YGTK_LINK_LABEL_H
-#include <gtk/gtkwidget.h>
+#include <gtk/gtk.h>
G_BEGIN_DECLS
#define YGTK_TYPE_LINK_LABEL (ygtk_link_label_get_type ())
Modified: trunk/gtk/src/ygtkmenubutton.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkmenubutton.c?rev=649…
==============================================================================
--- trunk/gtk/src/ygtkmenubutton.c (original)
+++ trunk/gtk/src/ygtkmenubutton.c Sat Jul 23 07:43:30 2011
@@ -33,7 +33,7 @@
static gboolean ygtk_popup_window_key_press_event (GtkWidget *widget, GdkEventKey *event)
{
- if (event->keyval == GDK_Escape) {
+ if (event->keyval == GDK_KEY_Escape) {
gtk_widget_hide (widget);
return TRUE;
}
@@ -54,7 +54,7 @@
while (child) {
if (child == widget)
return FALSE;
- child = child->parent;
+ child = gtk_widget_get_parent(child);
}
gtk_widget_hide (widget);
return TRUE;
@@ -88,7 +88,7 @@
*y = monitor.y;
else if (*y + req.height > monitor.y + monitor.height)
*y = monitor.y + monitor.height - req.height;
-}
+}
void ygtk_popup_window_popup (GtkWidget *widget, gint x, gint y, guint activate_time)
{
@@ -100,10 +100,10 @@
gtk_widget_show (widget);
// grab this with your teeth
- if (gdk_pointer_grab (widget->window, TRUE,
+ if (gdk_pointer_grab (gtk_widget_get_window(widget), TRUE,
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK,
NULL, NULL, activate_time) == 0)
- if (gdk_keyboard_grab (widget->window, TRUE, activate_time) != 0)
+ if (gdk_keyboard_grab (gtk_widget_get_window(widget), TRUE, activate_time) != 0)
gdk_pointer_ungrab (activate_time);
}
@@ -143,26 +143,27 @@
static void ygtk_menu_button_get_popup_pos (YGtkMenuButton *button, gint *x, gint *y)
{
GtkWidget *widget = GTK_WIDGET (button);
- GtkAllocation *button_alloc = &widget->allocation;
+ GtkAllocation button_alloc;
+ gtk_widget_get_allocation(widget, &button_alloc);
// the popup would look awful if smaller than the button
GtkRequisition req;
gtk_widget_size_request (button->popup, &req);
int popup_width = req.width, popup_height = req.height;
- if (button_alloc->width > req.width) {
- gtk_widget_set_size_request (button->popup, button_alloc->width, -1);
- popup_width = button_alloc->width;
+ if (button_alloc.width > req.width) {
+ gtk_widget_set_size_request (button->popup, button_alloc.width, -1);
+ popup_width = button_alloc.width;
}
- gdk_window_get_origin (widget->window, x, y);
- *x += button_alloc->x - popup_width*button->xalign;
- *y += (button_alloc->y-popup_height) + (button_alloc->height+popup_height)*button->yalign;
+ gdk_window_get_origin (gtk_widget_get_window(widget), x, y);
+ *x += button_alloc.x - popup_width*button->xalign;
+ *y += (button_alloc.y-popup_height) + (button_alloc.height+popup_height)*button->yalign;
// GTK doesn't push up menus if they are near the bottom, but we will...
int screen_height;
screen_height = gdk_screen_get_height (gtk_widget_get_screen (widget));
if (*y > screen_height - popup_height)
- *y -= popup_height + button_alloc->height;
+ *y -= popup_height + button_alloc.height;
}
static void ygtk_menu_button_get_menu_pos (GtkMenu *menu, gint *x, gint *y,
Modified: trunk/gtk/src/ygtkmenubutton.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkmenubutton.h?rev=649…
==============================================================================
--- trunk/gtk/src/ygtkmenubutton.h (original)
+++ trunk/gtk/src/ygtkmenubutton.h Sat Jul 23 07:43:30 2011
@@ -11,7 +11,7 @@
#ifndef YGTK_POPUP_WINDOW_H
#define YGTK_POPUP_WINDOW_H
-#include <gtk/gtkwindow.h>
+#include <gtk/gtk.h>
G_BEGIN_DECLS
#define YGTK_TYPE_POPUP_WINDOW (ygtk_popup_window_get_type ())
@@ -48,8 +48,6 @@
#ifndef YGTK_MENU_BUTTON_H
#define YGTK_MENU_BUTTON_H
-#include <gtk/gtktogglebutton.h>
-#include <gtk/gtkmenu.h>
G_BEGIN_DECLS
#define YGTK_TYPE_MENU_BUTTON (ygtk_menu_button_get_type ())
Modified: trunk/gtk/src/ygtkratiobox.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkratiobox.c?rev=64969…
==============================================================================
--- trunk/gtk/src/ygtkratiobox.c (original)
+++ trunk/gtk/src/ygtkratiobox.c Sat Jul 23 07:43:30 2011
@@ -13,7 +13,7 @@
static void ygtk_ratio_box_init (YGtkRatioBox *box)
{
- GTK_WIDGET_SET_FLAGS (box, GTK_NO_WINDOW);
+ gtk_widget_set_has_window (GTK_WIDGET(box), FALSE);
gtk_widget_set_redraw_on_allocate (GTK_WIDGET (box), FALSE);
}
@@ -61,7 +61,7 @@
for (child = box->children; child; child = child->next) {
YGtkRatioBoxChild *box_child = (YGtkRatioBoxChild*) child->data;
if (box_child->widget == widget) {
- gboolean was_visible = GTK_WIDGET_VISIBLE (widget);
+ gboolean was_visible = gtk_widget_get_visible (widget);
gtk_widget_unparent (widget);
box->children = g_list_remove_link (box->children, child);
@@ -93,10 +93,9 @@
/* We put size_request and _allocate in the same functions for both
orientations because it's just easier to maintain having the
logic in the same place. */
-
-static void ygtk_ratio_box_size_request (GtkWidget *widget,
- GtkRequisition *requisition,
- GtkOrientation orientation)
+static void ygtk_ratio_box_get_preferred_size (GtkWidget *widget,
+ GtkRequisition *requisition,
+ GtkOrientation orientation)
{
requisition->width = requisition->height = 0;
@@ -105,15 +104,16 @@
GList *i;
for (i = box->children; i; i = i->next) {
YGtkRatioBoxChild* child = i->data;
- if (!GTK_WIDGET_VISIBLE (child->widget))
+ if (!gtk_widget_get_visible (child->widget))
continue;
- GtkRequisition child_req;
- gtk_widget_size_request (child->widget, &child_req);
+ GtkRequisition min_child_req;
+ GtkRequisition nat_child_req;
+ gtk_widget_get_preferred_size (child->widget, &min_child_req, &nat_child_req);
if (orientation == GTK_ORIENTATION_HORIZONTAL)
- requisition->height = MAX (requisition->height, child_req.height);
+ requisition->height = MAX (requisition->height, min_child_req.height);
else
- requisition->width = MAX (requisition->width, child_req.width);
+ requisition->width = MAX (requisition->width, min_child_req.width);
children_nb++;
}
gint spacing = children_nb ? box->spacing*(children_nb-1) : 0;
@@ -122,7 +122,7 @@
else
requisition->height += spacing;
- int border = GTK_CONTAINER (box)->border_width;
+ int border = gtk_container_get_border_width(GTK_CONTAINER (box));
requisition->width += border*2;
requisition->height += border*2;
}
@@ -139,7 +139,7 @@
GList* i;
for (i = box->children; i; i = i->next) {
YGtkRatioBoxChild* child = i->data;
- if (!GTK_WIDGET_VISIBLE (child->widget))
+ if (!gtk_widget_get_visible (child->widget))
continue;
ratios_sum += child->ratio;
@@ -148,7 +148,7 @@
gint spacing = children_nb ? box->spacing*(children_nb-1) : 0;
- int border = GTK_CONTAINER (box)->border_width;
+ int border = gtk_container_get_border_width(GTK_CONTAINER (box));
int x = allocation->x + border, y = allocation->y + border,
width = allocation->width - border*2, height = allocation->height - border*2;
@@ -161,11 +161,12 @@
for (i = box->children; i; i = i->next) {
YGtkRatioBoxChild* child = i->data;
- if (!GTK_WIDGET_VISIBLE (child->widget))
+ if (!gtk_widget_get_visible (child->widget))
continue;
- GtkRequisition child_req;
- gtk_widget_get_child_requisition (child->widget, &child_req);
+ //GtkRequisition min_child_req;
+ //GtkRequisition nat_child_req;
+ //gtk_widget_get_preferred_size (child->widget, &min_child_req, &nat_child_req);
gint child_length = (child->ratio * length) / ratios_sum;
if (!i->next) // last takes rest (any residual length)
@@ -199,7 +200,7 @@
if (child_info) {
gtk_widget_freeze_child_notify (child);
child_info->ratio = ratio;
- if (GTK_WIDGET_VISIBLE (child) && GTK_WIDGET_VISIBLE (box))
+ if (gtk_widget_get_visible (child) && gtk_widget_get_visible (GTK_WIDGET(box)))
gtk_widget_queue_resize (child);
gtk_widget_thaw_child_notify (child);
@@ -229,9 +230,29 @@
static void ygtk_ratio_hbox_init (YGtkRatioHBox *box)
{ }
-static void ygtk_ratio_hbox_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{ ygtk_ratio_box_size_request (widget, requisition, GTK_ORIENTATION_HORIZONTAL); }
+static void ygtk_ratio_hbox_get_preferred_size (GtkWidget *widget,
+ GtkRequisition *requisition)
+{ ygtk_ratio_box_get_preferred_size (widget, requisition, GTK_ORIENTATION_HORIZONTAL); }
+
+static void
+ygtk_ratio_hbox_get_preferred_width (GtkWidget *widget,
+ gint *minimal_width,
+ gint *natural_width)
+{
+ GtkRequisition requisition;
+ ygtk_ratio_hbox_get_preferred_size (widget, &requisition);
+ *minimal_width = *natural_width = requisition.width;
+}
+
+static void
+ygtk_ratio_hbox_get_preferred_height (GtkWidget *widget,
+ gint *minimal_height,
+ gint *natural_height)
+{
+ GtkRequisition requisition;
+ ygtk_ratio_hbox_get_preferred_size (widget, &requisition);
+ *minimal_height = *natural_height = requisition.height;
+}
static void ygtk_ratio_hbox_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
@@ -249,7 +270,9 @@
ygtk_ratio_hbox_parent_class = (YGtkRatioBoxClass*) g_type_class_peek_parent (klass);
GtkWidgetClass* widget_class = GTK_WIDGET_CLASS (klass);
- widget_class->size_request = ygtk_ratio_hbox_size_request;
+ widget_class->get_preferred_width = ygtk_ratio_hbox_get_preferred_width;
+ widget_class->get_preferred_height = ygtk_ratio_hbox_get_preferred_height;
+
widget_class->size_allocate = ygtk_ratio_hbox_size_allocate;
}
@@ -260,9 +283,29 @@
static void ygtk_ratio_vbox_init (YGtkRatioVBox *box)
{ }
-static void ygtk_ratio_vbox_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{ ygtk_ratio_box_size_request (widget, requisition, GTK_ORIENTATION_VERTICAL); }
+static void ygtk_ratio_vbox_get_preferred_size (GtkWidget *widget,
+ GtkRequisition *requisition)
+{ ygtk_ratio_box_get_preferred_size (widget, requisition, GTK_ORIENTATION_VERTICAL); }
+
+static void
+ygtk_ratio_vbox_get_preferred_width (GtkWidget *widget,
+ gint *minimal_width,
+ gint *natural_width)
+{
+ GtkRequisition requisition;
+ ygtk_ratio_vbox_get_preferred_size (widget, &requisition);
+ *minimal_width = *natural_width = requisition.width;
+}
+
+static void
+ygtk_ratio_vbox_get_preferred_height (GtkWidget *widget,
+ gint *minimal_height,
+ gint *natural_height)
+{
+ GtkRequisition requisition;
+ ygtk_ratio_vbox_get_preferred_size (widget, &requisition);
+ *minimal_height = *natural_height = requisition.height;
+}
static void ygtk_ratio_vbox_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
@@ -280,7 +323,8 @@
ygtk_ratio_vbox_parent_class = g_type_class_peek_parent (klass);
GtkWidgetClass* widget_class = GTK_WIDGET_CLASS (klass);
- widget_class->size_request = ygtk_ratio_vbox_size_request;
+ widget_class->get_preferred_width = ygtk_ratio_vbox_get_preferred_width;
+ widget_class->get_preferred_height = ygtk_ratio_vbox_get_preferred_height;
widget_class->size_allocate = ygtk_ratio_vbox_size_allocate;
}
@@ -290,18 +334,18 @@
static void ygtk_adj_size_init (YGtkAdjSize *adj_size)
{
- GTK_WIDGET_SET_FLAGS (adj_size, GTK_NO_WINDOW);
+ gtk_widget_set_has_window(GTK_WIDGET(adj_size), FALSE);
gtk_widget_set_redraw_on_allocate (GTK_WIDGET (adj_size), FALSE);
}
-static void ygtk_adj_size_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
+static void ygtk_adj_size_get_preferred_size (GtkWidget *widget,
+ GtkRequisition *requisition)
{
- GtkWidget *child = GTK_BIN (widget)->child;
+ GtkWidget *child = gtk_bin_get_child(GTK_BIN (widget));
requisition->width = requisition->height = 0;
- if (child && GTK_WIDGET_VISIBLE (child)) {
+ if (child && gtk_widget_get_visible((child))) {
gtk_widget_size_request (child, requisition);
- guint border = GTK_CONTAINER (widget)->border_width;
+ guint border = gtk_container_get_border_width(GTK_CONTAINER (widget));
requisition->width += border * 2;
requisition->height += border * 2;
@@ -327,13 +371,34 @@
}
}
+static void
+ygtk_adj_size_get_preferred_width (GtkWidget *widget,
+ gint *minimal_width,
+ gint *natural_width)
+{
+ GtkRequisition requisition;
+ ygtk_adj_size_get_preferred_size (widget, &requisition);
+ *minimal_width = *natural_width = requisition.width;
+}
+
+static void
+ygtk_adj_size_get_preferred_height (GtkWidget *widget,
+ gint *minimal_height,
+ gint *natural_height)
+{
+ GtkRequisition requisition;
+ ygtk_adj_size_get_preferred_size (widget, &requisition);
+ *minimal_height = *natural_height = requisition.height;
+}
+
+
static void ygtk_adj_size_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
- GtkWidget *child = GTK_BIN (widget)->child;
- if (child && GTK_WIDGET_VISIBLE (child)) {
+ GtkWidget *child = gtk_bin_get_child(GTK_BIN (widget));
+ if (child && gtk_widget_get_visible (child)) {
GtkAllocation child_alloc = *allocation;
- guint border = GTK_CONTAINER (widget)->border_width;
+ guint border = gtk_container_get_border_width(GTK_CONTAINER (widget));
child_alloc.x += border;
child_alloc.y += border;
child_alloc.width -= border * 2;
@@ -378,7 +443,8 @@
ygtk_adj_size_parent_class = g_type_class_peek_parent (klass);
GtkWidgetClass* widget_class = GTK_WIDGET_CLASS (klass);
- widget_class->size_request = ygtk_adj_size_size_request;
+ widget_class->get_preferred_width = ygtk_adj_size_get_preferred_width;
+ widget_class->get_preferred_height = ygtk_adj_size_get_preferred_height;
widget_class->size_allocate = ygtk_adj_size_size_allocate;
}
Modified: trunk/gtk/src/ygtkratiobox.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkratiobox.h?rev=64969…
==============================================================================
--- trunk/gtk/src/ygtkratiobox.h (original)
+++ trunk/gtk/src/ygtkratiobox.h Sat Jul 23 07:43:30 2011
@@ -8,7 +8,7 @@
#ifndef YGTK_RATIO_BOX_H
#define YGTK_RATIO_BOX_H
-#include <gtk/gtkcontainer.h>
+#include <gtk/gtk.h>
G_BEGIN_DECLS
#define YGTK_TYPE_RATIO_BOX (ygtk_ratio_box_get_type ())
@@ -112,7 +112,6 @@
#ifndef YGTK_ADJ_SIZE_H
#define YGTK_ADJ_SIZE_H
-#include <gtk/gtkbin.h>
G_BEGIN_DECLS
#define YGTK_TYPE_ADJ_SIZE (ygtk_adj_size_get_type ())
Modified: trunk/gtk/src/ygtkrichtext.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkrichtext.c?rev=64969…
==============================================================================
--- trunk/gtk/src/ygtkrichtext.c (original)
+++ trunk/gtk/src/ygtkrichtext.c Sat Jul 23 07:43:30 2011
@@ -150,13 +150,13 @@
"foreground", "#000000", NULL);
}
-static void ygtk_rich_text_destroy (GtkObject *object)
+static void ygtk_rich_text_destroy (GtkWidget *widget)
{
// destroy can be called multiple times, and we must ref only once
- YGtkRichText *rtext = YGTK_RICH_TEXT (object);
+ YGtkRichText *rtext = YGTK_RICH_TEXT (widget);
gdk_cursor_unref (rtext->hand_cursor);
ygtk_rich_text_set_background (rtext, NULL);
- GTK_OBJECT_CLASS (ygtk_rich_text_parent_class)->destroy (object);
+ GTK_WIDGET_CLASS (ygtk_rich_text_parent_class)->destroy(widget);
}
// Change the cursor to the "hands" cursor typically used by web browsers,
@@ -165,9 +165,12 @@
{
if (wx == -1) {
GtkWidget *widget = GTK_WIDGET (view);
- gdk_window_get_pointer (widget->window, &wx, &wy, NULL);
- if (wx < 0 || wy < 0 || wx >= widget->allocation.width ||
- wy >= widget->allocation.height)
+ GtkAllocation alloc;
+ gtk_widget_get_allocation(widget, &alloc);
+
+ gdk_window_get_pointer (gtk_widget_get_window(widget), &wx, &wy, NULL);
+ if (wx < 0 || wy < 0 || wx >= alloc.width ||
+ wy >= alloc.height)
return;
}
@@ -191,25 +194,29 @@
return TRUE;
}
-static gboolean ygtk_rich_text_expose_event (GtkWidget *widget, GdkEventExpose *event)
+static gboolean ygtk_rich_text_draw (GtkWidget *widget, cairo_t *cr)
{
GtkTextView *text = GTK_TEXT_VIEW (widget);
YGtkRichText *rtext = YGTK_RICH_TEXT (widget);
+ GtkAllocation alloc;
+ gtk_widget_get_allocation(widget, &alloc);
if (rtext->background_pixbuf) {
GdkWindow *window = gtk_text_view_get_window (text, GTK_TEXT_WINDOW_TEXT);
- if (event->window == window) {
+ if (gtk_cairo_should_draw_window(cr, window)) {
int x, y;
int width = gdk_pixbuf_get_width (rtext->background_pixbuf);
int height = gdk_pixbuf_get_height (rtext->background_pixbuf);
gtk_text_view_buffer_to_window_coords (text, GTK_TEXT_WINDOW_TEXT,
- widget->allocation.width-((2*width)/5), -height/3, &x, &y);
- gdk_draw_pixbuf (GDK_DRAWABLE (window), *widget->style->fg_gc, rtext->background_pixbuf,
- 0, 0, x, y, -1, -1, GDK_RGB_DITHER_NONE, 0, 0);
+ alloc.width-((2*width)/5), -height/3, &x, &y);
+
+ gtk_cairo_transform_to_window(cr, widget, window);
+ gdk_cairo_set_source_pixbuf (cr, rtext->background_pixbuf, x, y);
+ cairo_paint (cr);
}
}
gboolean ret;
- ret = GTK_WIDGET_CLASS (ygtk_rich_text_parent_class)->expose_event (widget, event);
+ ret = GTK_WIDGET_CLASS (ygtk_rich_text_parent_class)->draw (widget, cr);
set_cursor_if_appropriate (text, -1, -1);
return ret;
}
@@ -722,10 +729,8 @@
{
GtkWidgetClass *gtkwidget_class = GTK_WIDGET_CLASS (klass);
gtkwidget_class->motion_notify_event = ygtk_rich_text_motion_notify_event;
- gtkwidget_class->expose_event = ygtk_rich_text_expose_event;
-
- GtkObjectClass *gtkobject_class = GTK_OBJECT_CLASS (klass);
- gtkobject_class->destroy = ygtk_rich_text_destroy;
+ gtkwidget_class->draw = ygtk_rich_text_draw;
+ gtkwidget_class->destroy = ygtk_rich_text_destroy;
link_clicked_signal = g_signal_new ("link-clicked",
G_TYPE_FROM_CLASS (G_OBJECT_CLASS (klass)), G_SIGNAL_RUN_LAST,
Modified: trunk/gtk/src/ygtksteps.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtksteps.c?rev=64969&r1…
==============================================================================
--- trunk/gtk/src/ygtksteps.c (original)
+++ trunk/gtk/src/ygtksteps.c Sat Jul 23 07:43:30 2011
@@ -39,9 +39,9 @@
steps->current_mark_timeout_id = steps->current_mark_frame = 0;
}
-static void ygtk_steps_destroy (GtkObject *object)
+static void ygtk_steps_destroy (GtkWidget *widget)
{
- YGtkSteps *steps = YGTK_STEPS (object);
+ YGtkSteps *steps = YGTK_STEPS (widget);
if (steps->current_mark_timeout_id) {
g_source_remove (steps->current_mark_timeout_id);
steps->current_mark_timeout_id = 0;
@@ -54,7 +54,8 @@
if (steps->todo_mark_layout)
g_object_unref (steps->todo_mark_layout);
steps->todo_mark_layout = NULL;
- GTK_OBJECT_CLASS (ygtk_steps_parent_class)->destroy (object);
+
+ GTK_WIDGET_CLASS (ygtk_steps_parent_class)->destroy(widget);
}
static void ygtk_step_update_layout (YGtkSteps *steps, gint step)
@@ -79,19 +80,21 @@
g_list_free (children);
}
-static gboolean ygtk_steps_expose_event (GtkWidget *widget, GdkEventExpose *event)
+static gboolean ygtk_steps_draw (GtkWidget *widget, cairo_t *cr)
{
- GTK_WIDGET_CLASS (ygtk_steps_parent_class)->expose_event (widget, event);
+ GTK_WIDGET_CLASS (ygtk_steps_parent_class)->draw(widget, cr);
YGtkSteps *steps = YGTK_STEPS (widget);
gboolean reverse = gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL;
GList *children = gtk_container_get_children (GTK_CONTAINER (widget)), *i;
- cairo_t *cr = gdk_cairo_create (event->window);
cairo_set_source_rgb (cr, 0, 0, 0);
int n = 0;
for (i = children; i; i = i->next, n++) {
GtkWidget *label = i->data;
+ GtkAllocation alloc;
+ gtk_widget_get_allocation(label, &alloc);
+
if (g_object_get_data (G_OBJECT (label), "is-header"))
continue;
PangoLayout *layout;
@@ -101,11 +104,11 @@
layout = steps->current_mark_layout;
else //if (n > steps->current_step)
layout = steps->todo_mark_layout;
- int x = label->allocation.x, y = label->allocation.y;
+ int x = alloc.x, y = alloc.y;
if (reverse) {
PangoRectangle rect;
pango_layout_get_pixel_extents (layout, NULL, &rect);
- x += label->allocation.width - rect.width - 4;
+ x += alloc.width - rect.width - 4;
}
else
x += 4;
@@ -122,7 +125,6 @@
cairo_move_to (cr, x, y);
pango_cairo_show_layout (cr, layout);
}
- cairo_destroy (cr);
g_list_free (children);
return FALSE;
}
@@ -189,7 +191,7 @@
ygtk_step_update_layout (steps, step);
}
- if (step != -1) {
+ if (step != -1 && step != old_step) {
steps->current_mark_frame = 0;
steps->current_mark_timeout_id = g_timeout_add
(CURRENT_MARK_ANIMATION_TIME / CURRENT_MARK_FRAMES_NB,
@@ -230,9 +232,7 @@
ygtk_steps_parent_class = g_type_class_peek_parent (klass);
GtkWidgetClass* widget_class = GTK_WIDGET_CLASS (klass);
- widget_class->expose_event = ygtk_steps_expose_event;
-
- GtkObjectClass *gtkobject_class = GTK_OBJECT_CLASS (klass);
- gtkobject_class->destroy = ygtk_steps_destroy;
+ widget_class->draw = ygtk_steps_draw;
+ widget_class->destroy = ygtk_steps_destroy;
}
Modified: trunk/gtk/src/ygtksteps.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtksteps.h?rev=64969&r1…
==============================================================================
--- trunk/gtk/src/ygtksteps.h (original)
+++ trunk/gtk/src/ygtksteps.h Sat Jul 23 07:43:30 2011
@@ -18,7 +18,7 @@
#ifndef YGTK_STEPS_H
#define YGTK_STEPS_H
-#include <gtk/gtkvbox.h>
+#include <gtk/gtk.h>
G_BEGIN_DECLS
#define YGTK_TYPE_STEPS (ygtk_steps_get_type ())
@@ -42,7 +42,7 @@
PangoLayout *check_mark_layout, *current_mark_layout, *todo_mark_layout;
// for current_mark little animation
guint current_mark_timeout_id, current_mark_frame;
-
+
} YGtkSteps;
typedef struct _YGtkStepsClass
Modified: trunk/gtk/src/ygtktextview.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtktextview.h?rev=64969…
==============================================================================
--- trunk/gtk/src/ygtktextview.h (original)
+++ trunk/gtk/src/ygtktextview.h Sat Jul 23 07:43:30 2011
@@ -9,7 +9,7 @@
#ifndef YGTK_TEXT_VIEW_H
#define YGTK_TEXT_VIEW_H
-#include <gtk/gtktextview.h>
+#include <gtk/gtk.h>
G_BEGIN_DECLS
#define YGTK_TYPE_TEXT_VIEW (ygtk_text_view_get_type ())
Modified: trunk/gtk/src/ygtktimezonepicker.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtktimezonepicker.c?rev…
==============================================================================
--- trunk/gtk/src/ygtktimezonepicker.c (original)
+++ trunk/gtk/src/ygtktimezonepicker.c Sat Jul 23 07:43:30 2011
@@ -72,7 +72,8 @@
gint *map_x, gint *map_y)
{
int win_width, win_height;
- gdk_window_get_size (picker->map_window, &win_width, &win_height);
+ win_width = gdk_window_get_width(picker->map_window);
+ win_height = gdk_window_get_height(picker->map_window);
*map_x = ((win_x - win_width/2) / picker->scale) + picker->map_x;
*map_y = ((win_y - win_height/2) / picker->scale) + picker->map_y;
@@ -82,7 +83,8 @@
gint *win_x, gint *win_y)
{
int win_width, win_height;
- gdk_window_get_size (picker->map_window, &win_width, &win_height);
+ win_width = gdk_window_get_width(picker->map_window);
+ win_height = gdk_window_get_height(picker->map_window);
*win_x = ((map_x - picker->map_x) * picker->scale) + win_width/2;
*win_y = ((map_y - picker->map_y) * picker->scale) + win_height/2;
@@ -244,12 +246,12 @@
static void ygtk_time_zone_picker_init (YGtkTimeZonePicker *picker)
{
- GTK_WIDGET_SET_FLAGS (picker, GTK_NO_WINDOW);
+ gtk_widget_set_has_window (GTK_WIDGET(picker), FALSE);
}
-static void ygtk_time_zone_picker_destroy (GtkObject *object)
+static void ygtk_time_zone_picker_destroy (GtkWidget *widget)
{
- YGtkTimeZonePicker *picker = YGTK_TIME_ZONE_PICKER (object);
+ YGtkTimeZonePicker *picker = YGTK_TIME_ZONE_PICKER (widget);
if (picker->map_pixbuf) {
g_object_unref (G_OBJECT (picker->map_pixbuf));
picker->map_pixbuf = NULL;
@@ -267,7 +269,7 @@
g_list_free (picker->locations);
picker->locations = NULL;
}
- GTK_OBJECT_CLASS (ygtk_time_zone_picker_parent_class)->destroy (object);
+ GTK_WIDGET_CLASS (ygtk_time_zone_picker_parent_class)->destroy(widget);
}
static void ygtk_time_zone_picker_realize (GtkWidget *widget)
@@ -277,11 +279,14 @@
YGtkTimeZonePicker *picker = YGTK_TIME_ZONE_PICKER (widget);
GdkWindowAttr attributes;
+ GtkAllocation alloc;
+ gtk_widget_get_allocation(widget, &alloc);
+
attributes.window_type = GDK_WINDOW_CHILD;
- attributes.x = widget->allocation.x;
- attributes.y = widget->allocation.y;
- attributes.width = widget->allocation.width;
- attributes.height = widget->allocation.height;
+ attributes.x = alloc.x;
+ attributes.y = alloc.y;
+ attributes.width = alloc.width;
+ attributes.height = alloc.height;
attributes.wclass = GDK_INPUT_OUTPUT;
attributes.event_mask = gtk_widget_get_events (widget);
attributes.event_mask |=
@@ -289,10 +294,12 @@
| GDK_POINTER_MOTION_MASK | GDK_LEAVE_NOTIFY_MASK);
gint attributes_mask;
attributes_mask = GDK_WA_X | GDK_WA_Y;
- picker->map_window = gdk_window_new (widget->window,
+ picker->map_window = gdk_window_new (gtk_widget_get_window(widget),
&attributes, attributes_mask);
gdk_window_set_user_data (picker->map_window, widget);
- gtk_style_set_background (widget->style, picker->map_window, GTK_STATE_NORMAL);
+
+ GtkStyleContext *style_ctx = gtk_widget_get_style_context(widget);
+ gtk_style_context_set_background(style_ctx, picker->map_window);
ygtk_time_zone_picker_closeup (picker, FALSE, 0, 0, FALSE);
}
@@ -399,18 +406,22 @@
return FALSE;
}
-static void ygtk_time_zone_picker_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
+static void ygtk_time_zone_picker_get_preferred_width (GtkWidget *widget,
+ gint *minimal_width, gint *natural_width)
{
- requisition->width = 600;
- requisition->height = 300;
- GTK_WIDGET_CLASS (ygtk_time_zone_picker_parent_class)->size_request (widget, requisition);
+ *minimal_width = *natural_width = 600;
+}
+
+static void ygtk_time_zone_picker_get_preferred_height (GtkWidget *widget,
+ gint *minimal_height, gint *natural_height)
+{
+ *minimal_height = *natural_height = 300;
}
static void ygtk_time_zone_picker_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
- if (!GTK_WIDGET_REALIZED (widget))
+ if (!gtk_widget_get_realized (widget))
return;
YGtkTimeZonePicker *picker = YGTK_TIME_ZONE_PICKER (widget);
int win_width = allocation->width, win_height = allocation->height;
@@ -443,16 +454,13 @@
(widget, allocation);
}
-static gboolean ygtk_time_zone_picker_expose_event (GtkWidget *widget,
- GdkEventExpose *event)
+static gboolean ygtk_time_zone_picker_draw (GtkWidget *widget, cairo_t *cr)
{
YGtkTimeZonePicker *picker = YGTK_TIME_ZONE_PICKER (widget);
- if (event->window != picker->map_window)
- return FALSE;
+ GtkStyleContext *style = gtk_widget_get_style_context(widget);
- cairo_t *cr = gdk_cairo_create (event->window);
- int width, height;
- gdk_window_get_size (event->window, &width, &height);
+ int width = gtk_widget_get_allocated_width(widget);
+ int height = gtk_widget_get_allocated_height(widget);
if (!picker->map_pixbuf) {
// show alt text if no image was loaded
@@ -537,9 +545,7 @@
}
cleanup:
- cairo_destroy (cr);
- gtk_paint_shadow (widget->style, event->window, GTK_STATE_NORMAL,
- GTK_SHADOW_IN, &event->area, widget, "frame", 0, 0, width, height);
+ gtk_render_frame (style, cr, 0, 0, width, height);
return TRUE;
}
@@ -552,16 +558,15 @@
widget_class->unrealize = ygtk_time_zone_picker_unrealize;
widget_class->map = ygtk_time_zone_picker_map;
widget_class->unmap = ygtk_time_zone_picker_unmap;
- widget_class->expose_event = ygtk_time_zone_picker_expose_event;
- widget_class->size_request = ygtk_time_zone_picker_size_request;
+ widget_class->draw = ygtk_time_zone_picker_draw;
+ widget_class->get_preferred_width = ygtk_time_zone_picker_get_preferred_width;
+ widget_class->get_preferred_height = ygtk_time_zone_picker_get_preferred_height;
widget_class->size_allocate = ygtk_time_zone_picker_size_allocate;
widget_class->button_press_event = ygtk_time_zone_picker_button_press_event;
widget_class->button_release_event = ygtk_time_zone_picker_button_release_event;
widget_class->motion_notify_event = ygtk_time_zone_picker_motion_notify_event;
widget_class->leave_notify_event = ygtk_time_zone_picker_leave_notify_event;
-
- GtkObjectClass *gtkobject_class = GTK_OBJECT_CLASS (klass);
- gtkobject_class->destroy = ygtk_time_zone_picker_destroy;
+ widget_class->destroy = ygtk_time_zone_picker_destroy;
zone_clicked_signal = g_signal_new ("zone_clicked",
G_TYPE_FROM_CLASS (G_OBJECT_CLASS (klass)), G_SIGNAL_RUN_LAST,
Modified: trunk/gtk/src/ygtktimezonepicker.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtktimezonepicker.h?rev…
==============================================================================
--- trunk/gtk/src/ygtktimezonepicker.h (original)
+++ trunk/gtk/src/ygtktimezonepicker.h Sat Jul 23 07:43:30 2011
@@ -10,7 +10,7 @@
#ifndef YGTK_TIME_ZONE_PICKER_H
#define YGTK_TIME_ZONE_PICKER_H
-#include <gtk/gtkwidget.h>
+#include <gtk/gtk.h>
#include <gdk/gdk.h>
G_BEGIN_DECLS
Modified: trunk/gtk/src/ygtktreeview.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtktreeview.c?rev=64969…
==============================================================================
--- trunk/gtk/src/ygtktreeview.c (original)
+++ trunk/gtk/src/ygtktreeview.c Sat Jul 23 07:43:30 2011
@@ -113,27 +113,26 @@
gtk_tree_view_convert_bin_window_to_widget_coords (
view, _popup_x, _popup_y, &_popup_x, &_popup_y);
gint x_orig, y_orig;
- gdk_window_get_origin (widget->window, &x_orig, &y_orig);
+ gdk_window_get_origin (gtk_widget_get_window(widget), &x_orig, &y_orig);
_popup_x += x_orig; _popup_y += y_orig;
g_signal_emit (widget, right_click_signal, 0, outreach);
return TRUE;
}
-static gboolean _ygtk_tree_view_expose_event (GtkWidget *widget, GdkEventExpose *event)
+static gboolean _ygtk_tree_view_draw (GtkWidget *widget, cairo_t *cr)
{
- GTK_WIDGET_CLASS (ygtk_tree_view_parent_class)->expose_event (widget, event);
+ GTK_WIDGET_CLASS (ygtk_tree_view_parent_class)->draw(widget, cr);
GtkTreeView *view = GTK_TREE_VIEW (widget);
YGtkTreeView *yview = YGTK_TREE_VIEW (widget);
- if (yview->empty_text && event->window == gtk_tree_view_get_bin_window (view)) {
+ if (yview->empty_text) {
GtkTreeModel *model = gtk_tree_view_get_model (view);
GtkTreeIter iter;
if (!model || !gtk_tree_model_get_iter_first (model, &iter)) { // empty tree-view
const gchar *text = yview->empty_text;
if (!model)
text = _("Loading...");
- cairo_t *cr = gdk_cairo_create (event->window);
PangoLayout *layout;
layout = gtk_widget_create_pango_layout (widget, text);
@@ -144,14 +143,15 @@
int width, height;
pango_layout_get_pixel_size (layout, &width, &height);
+ GtkAllocation allocation;
+ gtk_widget_get_allocation(widget, &allocation);
int x, y;
- x = (widget->allocation.width - width) / 2;
- y = (widget->allocation.height - height) / 2;
+ x = (allocation.width - width) / 2;
+ y = (allocation.height - height) / 2;
cairo_move_to (cr, x, y);
pango_cairo_show_layout (cr, layout);
g_object_unref (layout);
- cairo_destroy (cr);
}
}
return FALSE;
@@ -291,7 +291,7 @@
GtkWidgetClass *gtkwidget_class = GTK_WIDGET_CLASS (klass);
gtkwidget_class->button_press_event = ygtk_tree_view_button_press_event;
gtkwidget_class->popup_menu = _ygtk_tree_view_popup_menu;
- gtkwidget_class->expose_event = _ygtk_tree_view_expose_event;
+ gtkwidget_class->draw = _ygtk_tree_view_draw;
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
gobject_class->finalize = ygtk_tree_view_finalize;
@@ -299,6 +299,6 @@
right_click_signal = g_signal_new ("right-click",
G_OBJECT_CLASS_TYPE (klass), G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (YGtkTreeViewClass, right_click),
- NULL, NULL, gtk_marshal_VOID__BOOLEAN, G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
+ NULL, NULL, g_cclosure_marshal_VOID__BOOLEAN, G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
}
Modified: trunk/gtk/src/ygtktreeview.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtktreeview.h?rev=64969…
==============================================================================
--- trunk/gtk/src/ygtktreeview.h (original)
+++ trunk/gtk/src/ygtktreeview.h Sat Jul 23 07:43:30 2011
@@ -8,7 +8,7 @@
#ifndef YGTK_TREE_VIEW_H
#define YGTK_TREE_VIEW_H
-#include <gtk/gtktreeview.h>
+#include <gtk/gtk.h>
G_BEGIN_DECLS
#define YGTK_TYPE_TREE_VIEW (ygtk_tree_view_get_type ())
Modified: trunk/gtk/src/ygtkwizard.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkwizard.c?rev=64969&r…
==============================================================================
--- trunk/gtk/src/ygtkwizard.c (original)
+++ trunk/gtk/src/ygtkwizard.c Sat Jul 23 07:43:30 2011
@@ -21,8 +21,6 @@
#define YGI18N_C
#include "YGi18n.h"
-#define HELP_IMG_BG "yelp-icon-big"
-
// YGUtils bridge
extern char *ygutils_mapKBAccel (const char *src);
extern void ygutils_setWidgetFont (GtkWidget *widget, PangoStyle style,
@@ -120,6 +118,7 @@
dialog->help_text = ygtk_html_wrap_new();
gtk_container_add (GTK_CONTAINER (dialog->help_box), dialog->help_text);
+#if 0 // show a nice background image
GtkIconTheme *theme = gtk_icon_theme_get_default();
GtkIconInfo *info = gtk_icon_theme_lookup_icon (theme, HELP_IMG_BG, 192, 0);
if (info) {
@@ -133,6 +132,7 @@
}
gtk_icon_info_free (info);
}
+#endif
// bottom part (search entry + close button)
dialog->search_entry = gtk_entry_new();
@@ -149,7 +149,7 @@
G_CALLBACK (search_entry_activated_cb), dialog);
dialog->close_button = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
- GTK_WIDGET_SET_FLAGS (dialog->close_button, GTK_CAN_DEFAULT);
+ gtk_widget_set_can_default(dialog->close_button, TRUE);
GtkWidget *close_box = gtk_hbutton_box_new();
gtk_container_add (GTK_CONTAINER (close_box), dialog->close_button);
@@ -237,8 +237,8 @@
NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
GtkBindingSet *binding_set = gtk_binding_set_by_class (klass);
- gtk_binding_entry_add_signal (binding_set, GDK_F3, 0, "find_next", 0);
- gtk_binding_entry_add_signal (binding_set, GDK_Escape, 0, "close", 0);
+ gtk_binding_entry_add_signal (binding_set, GDK_KEY_F3, 0, "find_next", 0);
+ gtk_binding_entry_add_signal (binding_set, GDK_KEY_Escape, 0, "close", 0);
}
#ifdef SET_HELP_HISTORY
@@ -323,7 +323,7 @@
#else
if (help->text)
g_free (help->text);
- help->text = g_strdup (text);
+ help->text = g_strdup (text);
#endif
if (help->dialog)
ygtk_help_text_sync (help, NULL);
@@ -584,7 +584,7 @@
static GtkWidget *button_new (YGtkWizard *wizard)
{
GtkWidget *button = gtk_button_new_with_mnemonic ("");
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
+ gtk_widget_set_can_default(button, TRUE);
g_signal_connect (G_OBJECT (button), "clicked",
G_CALLBACK (button_clicked_cb), wizard);
return button;
@@ -647,7 +647,7 @@
GSList *buttons = gtk_size_group_get_widgets (group), *i;
int max_width = 0, total = 0;
for (i = buttons; i; i = i->next) {
- if (!GTK_WIDGET_VISIBLE (i->data))
+ if (!gtk_widget_get_visible (i->data))
continue;
GtkRequisition req;
gtk_widget_get_child_requisition ((GtkWidget *) i->data, &req);
@@ -1201,6 +1201,6 @@
NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
GtkBindingSet *binding_set = gtk_binding_set_by_class (klass);
- gtk_binding_entry_add_signal (binding_set, GDK_F1, 0, "popup_help", 0);
+ gtk_binding_entry_add_signal (binding_set, GDK_KEY_F1, 0, "popup_help", 0);
}
Modified: trunk/gtk/src/ygtkwizard.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkwizard.h?rev=64969&r…
==============================================================================
--- trunk/gtk/src/ygtkwizard.h (original)
+++ trunk/gtk/src/ygtkwizard.h Sat Jul 23 07:43:30 2011
@@ -11,8 +11,8 @@
#define YGTK_WIZARD_H
#include <gdk/gdk.h>
-#include <gtk/gtkwindow.h>
-#include <gtk/gtkvbox.h>
+#include <gtk/gtk.h>
+
G_BEGIN_DECLS
// test feature: history on help dialog
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0