[PATCH] New bonobo selector
- From: Anders Carlsson <andersca gnu org>
- To: gnome-components-list gnome org
- Subject: [PATCH] New bonobo selector
- Date: Sun, 30 Apr 2000 00:15:33 +0200
Hello,
here's a patch that gives the bonobo selector a new design, and if
you've got oaf it will take advantage of the extra "description" field
that oaf has.
A screenshot of the selector can be found at
http://info.stjerneskolan.com/~andersca/gnome/bonobo-selector.png
If anyone has any comments/suggestions I'd be glad to hear.
//andersca
andersca@gnu.org
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/bonobo/ChangeLog,v
retrieving revision 1.363
diff -u -r1.363 ChangeLog
--- ChangeLog 2000/04/29 22:04:09 1.363
+++ ChangeLog 2000/04/29 22:09:21
@@ -1,3 +1,29 @@
+2000-04-30 Anders Carlsson <andersca@gnu.org>
+
+ * bonobo/selector_test.c (panel_callback): Fix a segfault that
+ occured when using oaf. (Trying to free a non-allocated char pointer);
+
+ * bonobo/bonobo-selector.c (select_row): Set label to description field.
+ (bonobo_selector_init): New design of the BonoboSelector widget.
+ (add_gnorba_objects): Get the name.
+ (server_list_compare): Function for g_list_sort which sorts the
+ name list ascending.
+
+ * bonobo/bonobo-object-directory.h: Add extra name field
+
+ * bonobo/bonobo-object-directory.c (od_server_info_get_name): New function.
+ (od_server_info_unref): Free the new field.
+ (od_server_info_new): Take three parameters.
+
+ * bonobo/bonobo-object-directory-goad.c (od_get_server_list): Set new
+ description field to NULL since goad hasn't got a description.
+
+ * bonobo/bonobo-object-directory.c: Add extra name field.
+
+ * bonobo/Makefile.am (EXTRA_DIST): Add xpm file to EXTRA_DIST.
+
+ * bonobo/bonobo-insert-component.xpm: New file.
+
2000-04-29 Kjartan Maraas <kmaraas@online.no>
* bonobo/bonobo-uih-menu.c: Added #include <config.h>
Index: bonobo/Makefile.am
===================================================================
RCS file: /cvs/gnome/bonobo/bonobo/Makefile.am,v
retrieving revision 1.86
diff -u -r1.86 Makefile.am
--- bonobo/Makefile.am 2000/04/18 20:24:40 1.86
+++ bonobo/Makefile.am 2000/04/29 22:09:22
@@ -223,4 +223,5 @@
#endif
-EXTRA_DIST = $(GOAD_FILES) $(OAF_FILES)
+EXTRA_DIST = $(GOAD_FILES) $(OAF_FILES) \
+ bonobo-insert-component.xpm
Index: bonobo/bonobo-insert-component.xpm
===================================================================
RCS file: bonobo-insert-component.xpm
diff -N bonobo-insert-component.xpm
--- /dev/null Tue May 5 16:32:27 1998
+++ bonobo-insert-component.xpm Sat Apr 29 18:09:23 2000
@@ -0,0 +1,427 @@
+/* XPM */
+static char * bonobo_insert_component_xpm[] = {
+"48 48 376 2",
+" c None",
+". c #000000",
+"+ c #404040",
+"@ c #808080",
+"# c #6C6C6C",
+"$ c #585858",
+"% c #6B6B6B",
+"& c #7E7E7E",
+"* c #6E6E6E",
+"= c #5D5D5D",
+"- c #797979",
+"; c #727272",
+"> c #393939",
+", c #FFFFFF",
+"' c #D8D8D8",
+") c #B1B1B1",
+"! c #D6D6D6",
+"~ c #FBFBFB",
+"{ c #FDFDFD",
+"] c #DCDCDC",
+"^ c #BABABA",
+"/ c #F2F2F2",
+"( c #E4E4E4",
+"_ c #EAEAEA",
+": c #F0F0F0",
+"< c #F3F3F3",
+"[ c #F6F6F6",
+"} c #D4D4D4",
+"| c #B4B4B4",
+"1 c #E2E2E2",
+"2 c #CECECE",
+"3 c #676767",
+"4 c #E1E1E1",
+"5 c #E6E6E6",
+"6 c #ECECEC",
+"7 c #CCCCCC",
+"8 c #ADADAD",
+"9 c #D2D2D2",
+"0 c #B9B9B9",
+"a c #5C5C5C",
+"b c #3A3A36",
+"c c #74746B",
+"d c #75756C",
+"e c #76766D",
+"f c #74746A",
+"g c #737367",
+"h c #717163",
+"i c #717162",
+"j c #707062",
+"k c #6F6F5E",
+"l c #6D6D5A",
+"m c #64644F",
+"n c #5A5A44",
+"o c #2D2D22",
+"p c #5A5A5A",
+"q c #C4C4C4",
+"r c #DEDEDE",
+"s c #EBEBEB",
+"t c #ACACAC",
+"u c #B8B8B8",
+"v c #E9E9D6",
+"w c #EAEAD8",
+"x c #ECECDA",
+"y c #E9E9D5",
+"z c #E6E6CE",
+"A c #E2E2C6",
+"B c #E2E2C5",
+"C c #E1E1C4",
+"D c #DEDEBC",
+"E c #DADAB5",
+"F c #C7C79E",
+"G c #B4B487",
+"H c #4D4D4D",
+"I c #9A9A9A",
+"J c #B0B0B0",
+"K c #C6C6C6",
+"L c #E7E7E7",
+"M c #ABABAB",
+"N c #75756D",
+"O c #EAEADA",
+"P c #E8E8D1",
+"Q c #E4E4CA",
+"R c #E2E2C8",
+"S c #E0E0C2",
+"T c #DFDFC0",
+"U c #DBDBB8",
+"V c #D8D8B0",
+"W c #C2C298",
+"X c #ACAC80",
+"Y c #565640",
+"Z c #383838",
+"` c #717171",
+" . c #6A6A6A",
+".. c #636363",
+"+. c #747474",
+"@. c #868686",
+"#. c #989898",
+"$. c #969696",
+"%. c #959595",
+"&. c #CACACA",
+"*. c #CBCBCB",
+"=. c #949494",
+"-. c #4A4A4A",
+";. c #76766E",
+">. c #ECECDD",
+",. c #E8E8D2",
+"'. c #E3E3C8",
+"). c #E0E0C3",
+"!. c #DEDEC0",
+"~. c #DDDDBD",
+"{. c #D9D9B4",
+"]. c #D5D5AB",
+"^. c #BCBC92",
+"/. c #A3A37A",
+"(. c #52523D",
+"_. c #242424",
+":. c #484848",
+"<. c #222222",
+"[. c #434343",
+"}. c #616161",
+"|. c #7F7F7F",
+"1. c #A8A8A8",
+"2. c #AAAAAA",
+"3. c #8E8E8E",
+"4. c #707070",
+"5. c #24241A",
+"6. c #363628",
+"7. c #555549",
+"8. c #707061",
+"9. c #6C6C58",
+"0. c #48483A",
+"a. c #0C0C09",
+"b. c #12120E",
+"c. c #7F7F76",
+"d. c #ECECDE",
+"e. c #E8E8D4",
+"f. c #E4E4CB",
+"g. c #E4E4CC",
+"h. c #E3E3CA",
+"i. c #DEDEBF",
+"j. c #D5D5AC",
+"k. c #D0D0A2",
+"l. c #C4C496",
+"m. c #B8B88A",
+"n. c #65654C",
+"o. c #1B1B19",
+"p. c #4B4B45",
+"q. c #727266",
+"r. c #727265",
+"s. c #717164",
+"t. c #646456",
+"u. c #575749",
+"v. c #55554E",
+"w. c #535353",
+"x. c #8B8B8B",
+"y. c #C3C3C3",
+"z. c #C7C7C7",
+"A. c #4B4B4B",
+"B. c #6B6B4F",
+"C. c #AAAA92",
+"D. c #D7D7AF",
+"E. c #24241B",
+"F. c #88887D",
+"G. c #EDEDDF",
+"H. c #E8E8D6",
+"I. c #E7E7D2",
+"J. c #EAEAD7",
+"K. c #E6E6D0",
+"L. c #DEDEBE",
+"M. c #D6D6AD",
+"N. c #D1D1A3",
+"O. c #CCCC99",
+"P. c #78785A",
+"Q. c #E5E5CC",
+"R. c #E2E2C7",
+"S. c #A6A68B",
+"T. c #49493B",
+"U. c #272727",
+"V. c #828282",
+"W. c #E5E5E5",
+"X. c #BCBCBC",
+"Y. c #5E5E5E",
+"Z. c #505043",
+"`. c #A1A186",
+" + c #C2C2A8",
+".+ c #E4E4C9",
+"++ c #DADAB7",
+"@+ c #A4A48A",
+"#+ c #6E6E5E",
+"$+ c #787864",
+"%+ c #80806B",
+"&+ c #B7B7A4",
+"*+ c #EEEEDE",
+"=+ c #E6E6CF",
+"-+ c #E1E1C5",
+";+ c #D4D4AA",
+">+ c #D2D2A6",
+",+ c #AAAA8A",
+"'+ c #80806A",
+")+ c #777764",
+"!+ c #6E6E5C",
+"~+ c #A8A892",
+"{+ c #DDDDBB",
+"]+ c #D7D7B0",
+"^+ c #AEAE89",
+"/+ c #858562",
+"(+ c #535342",
+"_+ c #D0D0D0",
+":+ c #DDDDDD",
+"<+ c #6C6C5F",
+"[+ c #D7D7BE",
+"}+ c #DADABE",
+"|+ c #DEDEBD",
+"1+ c #E6E6CC",
+"2+ c #EEEEDD",
+"3+ c #EBEBD7",
+"4+ c #DFDFC1",
+"5+ c #D3D3A8",
+"6+ c #D8D8B2",
+"7+ c #DCDCBA",
+"8+ c #DBDBB9",
+"9+ c #E0E0C1",
+"0+ c #B6B688",
+"a+ c #9F9F76",
+"b+ c #5E5E49",
+"c+ c #1C1C1C",
+"d+ c #D5D5D5",
+"e+ c #A0A086",
+"f+ c #B7B796",
+"g+ c #CECEA6",
+"h+ c #C8C8A2",
+"i+ c #C3C39E",
+"j+ c #99997E",
+"k+ c #737362",
+"l+ c #777766",
+"m+ c #B2B2A0",
+"n+ c #ECECDB",
+"o+ c #E0E0C0",
+"p+ c #DDDDBC",
+"q+ c #D0D0A0",
+"r+ c #D0D0A1",
+"s+ c #C9C99F",
+"t+ c #C2C29C",
+"u+ c #98987C",
+"v+ c #6E6E5D",
+"w+ c #A2A285",
+"x+ c #CBCB9E",
+"y+ c #C0C090",
+"z+ c #7E7E5D",
+"A+ c #4C4C3C",
+"B+ c #1A1A1A",
+"C+ c #D1D1D1",
+"D+ c #E9E9E9",
+"E+ c #353527",
+"F+ c #6A6A4E",
+"G+ c #94946E",
+"H+ c #BEBE8E",
+"I+ c #B3B386",
+"J+ c #A8A87E",
+"K+ c #54543F",
+"L+ c #080808",
+"M+ c #111111",
+"N+ c #7E7E75",
+"O+ c #EBEBD9",
+"P+ c #BABA8B",
+"Q+ c #A7A77D",
+"R+ c #54543E",
+"S+ c #66664C",
+"T+ c #888866",
+"U+ c #5D5D44",
+"V+ c #3B3B2E",
+"W+ c #191919",
+"X+ c #B5B5B5",
+"Y+ c #CDCDCD",
+"Z+ c #E8E8E8",
+"`+ c #23231A",
+" @ c #4A4A37",
+".@ c #5F5F47",
+"+@ c #5A5A43",
+"@@ c #38382A",
+"#@ c #060606",
+"$@ c #76766A",
+"%@ c #DADAB6",
+"&@ c #CECE9E",
+"*@ c #444437",
+"=@ c #606048",
+"-@ c #494938",
+";@ c #38382C",
+">@ c #35352E",
+",@ c #313131",
+"'@ c #686868",
+")@ c #A0A0A0",
+"!@ c #B2B2B2",
+"~@ c #C5C5C5",
+"{@ c #C8C8C8",
+"]@ c #4C4C4C",
+"^@ c #0A0A0A",
+"/@ c #141414",
+"(@ c #2E2E2E",
+"_@ c #494949",
+":@ c #A5A5A5",
+"<@ c #8F8F8F",
+"[@ c #737373",
+"}@ c #3A3A3A",
+"|@ c #686856",
+"1@ c #D1D1AC",
+"2@ c #C5C59C",
+"3@ c #AEAE83",
+"4@ c #A4A47A",
+"5@ c #292929",
+"6@ c #525252",
+"7@ c #414141",
+"8@ c #444444",
+"9@ c #474747",
+"0@ c #505050",
+"a@ c #646464",
+"b@ c #8A8A8A",
+"c@ c #62624E",
+"d@ c #C4C49C",
+"e@ c #B6B68C",
+"f@ c #A0A078",
+"g@ c #50503C",
+"h@ c #303030",
+"i@ c #888888",
+"j@ c #8C8C8C",
+"k@ c #858585",
+"l@ c #E0E0E0",
+"m@ c #313127",
+"n@ c #5B5B46",
+"o@ c #28281E",
+"p@ c #626262",
+"q@ c #7A7A7A",
+"r@ c #929292",
+"s@ c #9E9E9E",
+"t@ c #9D9D9D",
+"u@ c #B7B7B7",
+"v@ c #DFDFDF",
+"w@ c #D3D3D3",
+"x@ c #A2A2A2",
+"y@ c #454545",
+"z@ c #3E3E3E",
+"A@ c #3F3F3F",
+"B@ c #373737",
+"C@ c #787878",
+"D@ c #C0C0C0",
+"E@ c #DADADA",
+"F@ c #BFBFBF",
+"G@ c #A4A4A4",
+"H@ c #7B7B7B",
+"I@ c #7C7C7C",
+"J@ c #8D8D8D",
+"K@ c #909090",
+"L@ c #838383",
+"M@ c #848484",
+"N@ c #878787",
+"O@ c #A6A6A6",
+"P@ c #B3B3B3",
+"Q@ c #C1C1C1",
+"R@ c #999999",
+"S@ c #939393",
+"T@ c #9B9B9B",
+"U@ c #A3A3A3",
+"V@ c #656565",
+"W@ c #BDBDBD",
+"X@ c #BEBEBE",
+"Y@ c #C2C2C2",
+"Z@ c #B6B6B6",
+"`@ c #C9C9C9",
+" # c #E3E3E3",
+".# c #A9A9A9",
+"+# c #F4F4F4",
+"@# c #757575",
+"## c #BBBBBB",
+"$# c #AFAFAF",
+"%# c #606060",
+"&# c #4E4E4E",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+" . . + @ @ @ @ @ @ @ # $ % & & & & @ @ @ @ @ * = * @ @ @ @ @ - ; > . ",
+" . . @ , , , , , , , ' ) ! ~ ~ ~ { , , , , , ] ^ ] , , , , , / ( ; . ",
+" . . . . . + @ @ @ @ @ @ @ # $ % & ) ( _ : < [ [ [ } | } [ [ [ [ [ 1 2 3 . ",
+" . . . . . . . . . . . . . . . . . . 3 2 ' 4 5 6 6 6 7 8 7 6 6 6 6 6 9 0 a . ",
+" . . b c d e d f g h i j k l m n o . p | q } r _ s 6 7 t 7 6 6 6 6 6 9 u a . ",
+" . . c v w x w y z A B C D E F G n . H I J K ! L _ 6 7 M 7 6 6 6 6 6 9 u a . ",
+" . . . . . . . N O y P z Q R C S T U V W X Y . Z ` ...% +.@.#.$.%.J &.*.7 7 7 J =.-.. ",
+" . . . . . . . . . ;.>.,.'.C T S ).!.~.{.].^./.(.. _.:._.. . . <.[.}.|.=.1.2.M M M 3.4.Z . ",
+". . 5.6.7.f 8.9.0.. a.b.c.d.e.Q f.g.Q h.i.E j.k.l.m.n.b.o._.p.q.r.s.t.u.v.w.x.y.z.7 7 7 ) $.A.. ",
+". . 6.B.C.y S D.9.. b.E.F.G.H.g.I.J.e.K.L.M.N.O.O.O.P.E.b.. q.Q.Q R.S.B.T.U.V.r W.6 6 6 } X.Y.. ",
+". . Z.`. +.+T ++@+#+$+%+&+*+w ,.=+g.-+L.{.;+>+k.>+;+,+'+)+!+~+A {+]+^+/+(+<.- _+:+_ s 6 } X.Y.. ",
+". . <+[+}+|+L.i.|+{+{+{+1+2+x 3+Q.4+++M.;+5+;+].6+7+7+7+7+8+|+9+M.O.0+a+b+c+4.y.d+L _ 6 } X.Y.. ",
+". . Z.e+f+g+h+i+j+#+k+l+m+n+z o+p+++M.N.k.q+r+k.s+t+u+v+v+!+w+M.x+y+a+z+A+B+% X.C+5 D+6 } X.Y.. ",
+". . E+F+G+H+I+J+K+. L+M+N+O+S ;+j.M.N.O.O.O.O.O.P+Q+R+. . . S+O.y+G T+U+V+W+3 X+Y+W.Z+6 } X.Y.. ",
+". . `+E+ @.@+@K+@@. #@L+$@f.%@k.k.N.&@O.O.O.O.O.P+Q+R+. M+<.*@S+=@n -@;@>@,@'@)@!@~@{@7 !@#.]@. ",
+" . . . . . . . . . k |+].O.O.O.O.O.O.O.O.O.P+Q+R+. <.[.<.. . . ^@/@(@_@ .x.#.:@1.M <@[@}@. ",
+" . . . . . . . |@1@2@P+P+P+P+P+P+P+P+P+3@4@(.. 5@6@-.7@8@9@A.0@p a@b@J X.{@&.7 !@#.]@. ",
+" . . c@d@e@Q+Q+Q+Q+Q+Q+Q+Q+Q+4@f@g@. h@}.; V.i@3.j@x.k@|.2.} l@s 6 6 } X.Y.. ",
+" . . m@c@n@R+R+R+R+R+R+R+R+R+(.g@o@. ,@p@q@r@s@2.2.t t@3.u@v@W.6 6 6 w@^ = . ",
+" . . . . . . . . . . . . . . . . . . ,@p@V.x@| ~@{@7 X+s@q _ s 6 6 6 9 u a . ",
+" . . . . . <.y@7@z@z@z@z@A@B@(@B@+ a C@r@8 D@9 ! E@F@G@{@s 6 6 6 6 w@^ = . ",
+" . . y@b@V.H@H@H@I@& * = * @ @.J@x@u 7 v@( D+&.2.*.6 6 6 6 6 } X.Y.. ",
+" . . :.K@b@L@M@@.i@j@I@# q@N@i@b@#.O@P@Q@q {@J #.) &.*.7 7 7 !@#.]@. ",
+" . . A.$.K@x.3.K@=.R@b@H@M@3.b@@.j@S@T@U@G@O@$.k@$.1.2.M M M K@+.}@. ",
+" . . V@&.y.X.W@X@D@Y@M S@O@^ Z@!@X+0 F@~@z.`@J #.) &.*.7 7 7 ) $.A.. ",
+" . . @ , [ 6 6 6 6 6 7 M {@W.4 :+r v@ #L _ 6 7 M 7 6 6 6 6 6 9 u a . ",
+" . . @ , [ 6 6 6 6 6 *.2.`@Z+5 ( ( W.L _ s 6 *.2.*.6 6 6 6 6 w@^ = . ",
+" . . @ , [ 6 6 6 6 6 &.1.&.6 6 s s s 6 6 6 6 &..#&.6 6 6 6 6 } X.Y.. ",
+" . . q@+#5 ' ' ' ! ! !@3.) } } } } } } } } } | =.P@9 w@} } } Y@J $ . ",
+" . . +.D+! y.y.y.Q@F@I @##.X.X.X.X.X.X.X.X.X.t@& T@u ^ X.X.##$#U@6@. ",
+" . . }@+.% p@p@p@%#%#H }@]@Y.Y.Y.Y.Y.Y.Y.Y.Y.&#A@&#a = Y.Y.Y.$ 6@5@. ",
+" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+" ",
+" ",
+" ",
+" ",
+" "};
Index: bonobo/bonobo-object-directory-goad.c
===================================================================
RCS file: /cvs/gnome/bonobo/bonobo/bonobo-object-directory-goad.c,v
retrieving revision 1.4
diff -u -r1.4 bonobo-object-directory-goad.c
--- bonobo/bonobo-object-directory-goad.c 2000/04/28 21:48:16 1.4
+++ bonobo/bonobo-object-directory-goad.c 2000/04/29 22:09:24
@@ -61,7 +61,8 @@
ODServerInfo *info;
info = od_server_info_new (goad_list->list [i].server_id,
- goad_list->list [i].description);
+ goad_list->list [i].description,
+ NULL);
retval = g_list_prepend (retval, info);
}
Index: bonobo/bonobo-object-directory-oaf.c
===================================================================
RCS file: /cvs/gnome/bonobo/bonobo/bonobo-object-directory-oaf.c,v
retrieving revision 1.3
diff -u -r1.3 bonobo-object-directory-oaf.c
--- bonobo/bonobo-object-directory-oaf.c 2000/04/28 21:48:16 1.3
+++ bonobo/bonobo-object-directory-oaf.c 2000/04/29 22:09:24
@@ -19,7 +19,7 @@
gchar **query_components;
OAF_ServerInfoList *servers;
CORBA_Environment ev;
- guint i;
+ guint i, j;
g_return_val_if_fail(required_ids != NULL, NULL);
g_return_val_if_fail(*required_ids != NULL, NULL);
@@ -57,20 +57,43 @@
return NULL;
}
- i = 0;
- while (i < servers->_length) {
+ for (i = 0; i < servers->_length; i++) {
OAF_ServerInfo *oafinfo = &servers->_buffer[i];
ODServerInfo *info;
+ gchar *name = NULL, *desc = NULL;
- /* FIXME: should try to get "description" attribute if
- present, otherwise use iid for description. */
+ for (j = 0; j < oafinfo->attrs._length; j++) {
+ if (oafinfo->attrs._buffer[j].v._d != OAF_A_STRING)
+ continue;
+
+ if (strcmp (oafinfo->attrs._buffer[j].name, "name") == 0) {
+ name = oafinfo->attrs._buffer[j].v._u.value_string;
+ }
+
+ else if (strcmp (oafinfo->attrs._buffer[j].name, "description") == 0)
+ desc = oafinfo->attrs._buffer[j].v._u.value_string;
+ }
+
+ /* If no name attribute exists, use the description attribute.
+ If no description attribute exists, use the name attribute.
+ If neither a description attribute nor a name attribute exists, use the oafiid */
+ if (!name && !desc)
+ name = desc = oafinfo->iid;
+
+ if (!name)
+ name = desc;
+
+ if (!desc)
+ desc = name;
+
info = od_server_info_new(oafinfo->iid,
- /* description */ oafinfo->iid);
+ name,
+ desc);
+
retval = g_list_prepend(retval, info);
- ++i;
}
CORBA_free(servers);
Index: bonobo/bonobo-object-directory.c
===================================================================
RCS file: /cvs/gnome/bonobo/bonobo/bonobo-object-directory.c,v
retrieving revision 1.1
diff -u -r1.1 bonobo-object-directory.c
--- bonobo/bonobo-object-directory.c 2000/01/25 22:04:41 1.1
+++ bonobo/bonobo-object-directory.c 2000/04/29 22:09:24
@@ -5,11 +5,12 @@
struct _ODServerInfo {
guint refcount;
gchar* iid;
+ gchar* name;
gchar* desc;
};
ODServerInfo*
-od_server_info_new(const gchar* iid, const gchar* desc)
+od_server_info_new(const gchar* iid, const gchar* name, const gchar* desc)
{
ODServerInfo *info;
@@ -17,6 +18,7 @@
info->refcount = 1;
info->iid = iid ? g_strdup(iid) : NULL;
+ info->name = name ? g_strdup(name) : NULL;
info->desc = desc ? g_strdup(desc) : NULL;
return info;
@@ -29,6 +31,12 @@
}
const gchar*
+od_server_info_get_name (ODServerInfo *info)
+{
+ return info->name;
+}
+
+const gchar*
od_server_info_get_description (ODServerInfo *info)
{
return info->desc;
@@ -50,6 +58,7 @@
if (info->refcount == 0) {
g_free(info->iid);
+ g_free(info->name);
g_free(info->desc);
g_free(info);
}
Index: bonobo/bonobo-object-directory.h
===================================================================
RCS file: /cvs/gnome/bonobo/bonobo/bonobo-object-directory.h,v
retrieving revision 1.2
diff -u -r1.2 bonobo-object-directory.h
--- bonobo/bonobo-object-directory.h 2000/04/18 20:24:40 1.2
+++ bonobo/bonobo-object-directory.h 2000/04/29 22:09:24
@@ -27,8 +27,10 @@
CORBA_ORB od_get_orb (void);
ODServerInfo *od_server_info_new (const gchar *iid,
+ const gchar *name,
const gchar *desc);
const gchar *od_server_info_get_id (ODServerInfo *info);
+const gchar *od_server_info_get_name (ODServerInfo *info);
const gchar *od_server_info_get_description (ODServerInfo *info);
void od_server_info_ref (ODServerInfo *info);
void od_server_info_unref (ODServerInfo *info);
Index: bonobo/bonobo-selector.c
===================================================================
RCS file: /cvs/gnome/bonobo/bonobo/bonobo-selector.c,v
retrieving revision 1.22
diff -u -r1.22 bonobo-selector.c
--- bonobo/bonobo-selector.c 2000/04/18 20:24:40 1.22
+++ bonobo/bonobo-selector.c 2000/04/29 22:09:25
@@ -4,6 +4,7 @@
#include <string.h> /* strcmp */
#include <gnome.h>
#include "bonobo-object-directory.h"
+#include "bonobo-insert-component.xpm"
#define DEFAULT_INTERFACE "IDL:Bonobo/Embeddable:1.0"
@@ -12,6 +13,7 @@
struct _BonoboSelectorPrivate
{
GtkWidget *clist;
+ GtkWidget *desc_label;
GList *servers;
int n_servers;
const gchar **interfaces_required;
@@ -165,7 +167,7 @@
* depending on the activation framework you are using.
*/
-static gchar *
+gchar *
bonobo_selector_get_selected_id (BonoboSelector *sel)
{
GList *selection;
@@ -349,8 +351,14 @@
gnome_dialog_clicked ( GNOME_DIALOG (sel), 0);
else {
GtkCListClass *cl;
-
+ gchar *text;
+
+ gtk_clist_get_text (GTK_CLIST (clist), row,
+ 2, &text);
+ gtk_label_set_text (GTK_LABEL (sel->priv->desc_label), text);
+
cl = gtk_type_class (GTK_TYPE_CLIST);
+
if (cl->select_row)
cl->select_row (clist, row, col, event);
}
@@ -360,31 +368,51 @@
bonobo_selector_init (GtkWidget *widget)
{
BonoboSelector *sel = BONOBO_SELECTOR (widget);
- GtkWidget *scrolled;
+ GtkWidget *scrolled, *pixmap;
+ GtkWidget *vbox, *hbox;
+ GtkWidget *frame;
+
BonoboSelectorPrivate *priv;
- gchar *titles[] = { N_("Bonobo object description"), "ID", NULL };
+ gchar *titles[] = { N_("Name"), "Description", "ID", NULL };
g_return_if_fail (widget != NULL);
-
+
+ titles[0] = gettext (titles[0]);
sel->priv = g_new0 (BonoboSelectorPrivate, 1);
priv = sel->priv;
+
+ vbox = gtk_vbox_new (FALSE, 0);
scrolled = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
-
- titles[0] = gettext(titles[0]);
- priv->clist = gtk_clist_new_with_titles (2, titles);
+ priv->clist = gtk_clist_new_with_titles (3, titles);
gtk_clist_set_selection_mode (GTK_CLIST (priv->clist),
GTK_SELECTION_BROWSE);
gtk_signal_connect (GTK_OBJECT (priv->clist), "select-row",
GTK_SIGNAL_FUNC (select_row), sel);
gtk_clist_set_column_visibility (GTK_CLIST (priv->clist), 1, FALSE);
+ gtk_clist_set_column_visibility (GTK_CLIST (priv->clist), 2, FALSE);
gtk_container_add (GTK_CONTAINER (scrolled), priv->clist);
+ gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (sel)->vbox), scrolled, TRUE, TRUE, 0);
+
+ frame = gtk_frame_new (_("Description"));
+ gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (sel)->vbox), frame, FALSE, TRUE, 0);
+
- gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (sel)->vbox), scrolled,
- TRUE, TRUE, 0);
+ priv->desc_label = gtk_label_new ("");
+ gtk_misc_set_alignment (GTK_MISC (priv->desc_label), 0.0, 0.5);
+ gtk_label_set_line_wrap (GTK_LABEL (priv->desc_label), TRUE);
+ gtk_label_set_justify (GTK_LABEL (priv->desc_label), GTK_JUSTIFY_LEFT);
+
+ hbox = gtk_hbox_new (FALSE, 0);
+
+ pixmap = gnome_pixmap_new_from_xpm_d (bonobo_insert_component_xpm);
+ gtk_box_pack_start (GTK_BOX (hbox), pixmap, FALSE, TRUE, GNOME_PAD_SMALL);
+
+ gtk_box_pack_start (GTK_BOX (hbox), priv->desc_label, TRUE, TRUE, GNOME_PAD_SMALL);
+ gtk_container_add (GTK_CONTAINER (frame), hbox);
gnome_dialog_append_button (GNOME_DIALOG (sel), GNOME_STOCK_BUTTON_OK);
gnome_dialog_append_button (GNOME_DIALOG (sel),
@@ -395,20 +423,19 @@
gtk_signal_connect (GTK_OBJECT (sel), "close",
GTK_SIGNAL_FUNC (button_callback), sel);
- gtk_widget_set_usize (priv->clist, 200, 200);
- gtk_widget_show (priv->clist);
- gtk_widget_show (scrolled);
+ gtk_widget_set_usize (widget, 400, 300);
+ gtk_widget_show_all (GNOME_DIALOG (sel)->vbox);
}
static void
add_gnorba_objects (BonoboSelector *widget)
{
- const gchar *text[3];
+ const gchar *text[4];
GList *list = NULL;
BonoboSelectorPrivate *priv;
-
- text[2] = NULL;
-
+
+ text[3] = NULL;
+
g_return_if_fail (widget != NULL);
priv = widget->priv;
@@ -428,8 +455,10 @@
while (list != NULL)
{
- text[0] = od_server_info_get_description(list->data);
+ text[0] = od_server_info_get_name(list->data);
text[1] = od_server_info_get_id(list->data);
+ text[2] = od_server_info_get_description(list->data);
+
gtk_clist_append (GTK_CLIST (priv->clist), (gchar**)text);
priv->n_servers++;
list = list->next;
@@ -438,6 +467,14 @@
gtk_clist_thaw (GTK_CLIST (priv->clist));
}
+static gint
+server_list_compare (gconstpointer a, gconstpointer b)
+{
+ return strcmp (od_server_info_get_name ((ODServerInfo *)a),
+ od_server_info_get_name ((ODServerInfo *)b));
+
+}
+
static GList *
get_filtered_objects (BonoboSelector *widget)
{
@@ -469,5 +506,8 @@
if (priv->interfaces_required == NULL)
g_free (inters);
+ /* Sort the list */
+ g_list_sort (priv->servers, server_list_compare);
+
return priv->servers;
}
Index: bonobo/selector_test.c
===================================================================
RCS file: /cvs/gnome/bonobo/bonobo/selector_test.c,v
retrieving revision 1.10
diff -u -r1.10 selector_test.c
--- bonobo/selector_test.c 2000/04/18 20:24:40 1.10
+++ bonobo/selector_test.c 2000/04/29 22:09:26
@@ -68,14 +68,16 @@
gchar *text;
#if USING_OAF
-
+ g_warning ("You can't get an id of a panel applet since the panel"
+ "is using GOAD at the moment");
#else
text = gnome_bonobo_select_goad_id (_("Select an object"), ints);
-#endif
g_print("%s\n", text);
if (text != NULL)
g_free(text);
+#endif
+
}
void noact_callback (GtkWidget *widget, gpointer data)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]