summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2009-12-27 15:02:03 +0100
committerGravatar Nikias Bassen2009-12-27 15:02:03 +0100
commit1d807233aa6c3c5d2378b9f979af4896015b49b4 (patch)
tree95f291ec8ab396e96dbf2166136758ead41149b7 /src
parente9e32d512990f4e1dcfc7378631965f41b8aa503 (diff)
downloadsbmanager-1d807233aa6c3c5d2378b9f979af4896015b49b4.tar.gz
sbmanager-1d807233aa6c3c5d2378b9f979af4896015b49b4.tar.bz2
Fix icon alignment for pages with less than 16 items
This removes the skip_empty parameter from get_icon_for_node as empty nodes are always skipped now. This also makes alignment easier.
Diffstat (limited to 'src')
-rw-r--r--src/sbmanager.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/sbmanager.c b/src/sbmanager.c
index 386f4ea..5ef3d04 100644
--- a/src/sbmanager.c
+++ b/src/sbmanager.c
@@ -127,18 +127,14 @@ static void sbpage_free(GList *sbitems)
}
}
-static void get_icon_for_node(plist_t node, GList **list, sbservices_client_t sbc, gboolean skip_empty)
+static void get_icon_for_node(plist_t node, GList **list, sbservices_client_t sbc)
{
char *png = NULL;
uint64_t pngsize = 0;
SBItem *di = NULL;
plist_t valuenode = NULL;
if (plist_get_node_type(node) != PLIST_DICT) {
- if (!skip_empty) {
- di = g_new0(SBItem, 1);
- *list = g_list_append(*list, di);
- return;
- }
+ return;
}
valuenode = plist_dict_get_item(node, "displayIdentifier");
if (valuenode && (plist_get_node_type(valuenode) == PLIST_STRING)) {
@@ -287,7 +283,7 @@ static gboolean get_icons(gpointer data)
num_dock_items = count;
for (i = 0; i < count; i++) {
plist_t node = plist_array_get_item(dock, i);
- get_icon_for_node(node, &dockitems, sbc, TRUE);
+ get_icon_for_node(node, &dockitems, sbc);
}
if (total > 1) {
/* get all icons for the other pages */
@@ -313,7 +309,7 @@ static gboolean get_icons(gpointer data)
for (i = 0; i < count; i++) {
plist_t node = plist_array_get_item(nrow,
i);
- get_icon_for_node(node, &page, sbc, FALSE);
+ get_icon_for_node(node, &page, sbc);
}
}
if (page) {
@@ -821,15 +817,19 @@ static gboolean set_icons(gpointer data)
GList *page = g_list_nth_data(sbpages, i);
if (page) {
guint j;
+ count = g_list_length(page);
+ if (count <= 0) {
+ continue;
+ }
plist_t ppage = plist_new_array();
plist_t row = NULL;
- for (j = 0; j < g_list_length(page); j++) {
+ for (j = 0; j < 16; j++) {
SBItem *item = g_list_nth_data(page, j);
if ((j % 4) == 0) {
row = plist_new_array();
plist_array_append_item(ppage, row);
}
- if (item->node) {
+ if (item && item->node) {
plist_t valuenode = plist_dict_get_item(item->node,
"displayIdentifier");
if (!valuenode) {