elementaryart team mailing list archive
-
elementaryart team
-
Mailing list archive
-
Message #01898
[Merge] lp:~victored/granite/mode-button-append-rv into lp:granite
Victor Eduardo has proposed merging lp:~victored/granite/mode-button-append-rv into lp:granite.
Requested reviews:
xapantu (xapantu)
For more details, see:
https://code.launchpad.net/~victored/granite/mode-button-append-rv/+merge/90193
[API]
Granite.Widgets.ModeButton:
* Modified return values for append functions (void -> int)
--
https://code.launchpad.net/~victored/granite/mode-button-append-rv/+merge/90193
Your team elementaryart (old) is subscribed to branch lp:granite.
=== modified file 'lib/Widgets/ModeButton.vala'
--- lib/Widgets/ModeButton.vala 2012-01-24 18:21:37 +0000
+++ lib/Widgets/ModeButton.vala 2012-01-25 19:26:30 +0000
@@ -104,23 +104,23 @@
can_focus = true;
}
- public void append_pixbuf (Gdk.Pixbuf? pixbuf) {
+ public int append_pixbuf (Gdk.Pixbuf? pixbuf) {
if (pixbuf == null) {
warning ("GraniteWidgetsModeButton: Attempt to add null pixbuf failed.");
- return;
+ return -1;
}
var image = new Image.from_pixbuf (pixbuf);
- append (image);
+ return append (image);
}
- public void append_text (string? text) {
+ public int append_text (string? text) {
if (text == null) {
warning ("GraniteWidgetsModeButton: Attempt to add null text string failed.");
- return;
+ return -1;
}
- append (new Gtk.Label(text));
+ return append (new Gtk.Label(text));
}
/**
@@ -129,14 +129,14 @@
* each state of the widget. That is, it will match the foreground color
* defined by the theme for each state (active, prelight, insensitive, etc.)
*/
- public void append_icon (string icon_name, Gtk.IconSize size) {
- append (new Image.from_icon_name (icon_name, size));
+ public int append_icon (string icon_name, Gtk.IconSize size) {
+ return append (new Image.from_icon_name (icon_name, size));
}
- public void append (Gtk.Widget w) {
+ public int append (Gtk.Widget w) {
if (w == null) {
warning ("GraniteWidgetsModeButton: Attempt to add null widget failed.");
- return;
+ return -1;
}
var button = new ModeButtonItem ();
@@ -152,7 +152,9 @@
add (button);
button.show_all ();
- mode_added ((int)get_children ().length (), w);
+ int item_index = (int)get_children ().length ();
+ mode_added (item_index, w); // Emit the added signal
+ return item_index;
}
public void set_active (int new_active_index) {
Follow ups