diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 3 | ||||
-rw-r--r-- | src/gnome-plist-editor.c | 6 | ||||
-rw-r--r-- | src/plist-utils.c | 71 | ||||
-rw-r--r-- | src/plist-utils.h | 30 |
4 files changed, 5 insertions, 105 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index f5cf7a8..efa046e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,8 +1,7 @@ bin_PROGRAMS = gnome-plist-editor gnome_plist_editor_SOURCES = \ - gnome-plist-editor.c \ - plist-utils.c + gnome-plist-editor.c gnome_plist_editor_CFLAGS = \ -Wl,--export-dynamic \ diff --git a/src/gnome-plist-editor.c b/src/gnome-plist-editor.c index 6badefb..c2de09d 100644 --- a/src/gnome-plist-editor.c +++ b/src/gnome-plist-editor.c @@ -27,7 +27,6 @@ #include <gio/gio.h> #include <plist/plist.h> -#include "plist-utils.h" static struct AppState { GtkWindow *main_window; @@ -502,8 +501,11 @@ void plist_cell_data_function (GtkTreeViewColumn *col, text = "FIXME: Parse Dates"; break; case PLIST_ARRAY: + text = g_strdup_printf("(%d items)", plist_array_get_size(node)); + g_object_set(renderer, "sensitive", FALSE, NULL); + break; case PLIST_DICT: - text = g_strdup_printf("(%d items)", plist_node_get_item_count(node)); + text = g_strdup_printf("(%d items)", plist_dict_get_size(node)); g_object_set(renderer, "sensitive", FALSE, NULL); break; default: diff --git a/src/plist-utils.c b/src/plist-utils.c deleted file mode 100644 index cc3d11e..0000000 --- a/src/plist-utils.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * plist-utils.c - * - * Copyright (C) 2009 Martin Szulecki <opensuse@sukimashita.com> - * - * The code contained in this file is free software; you can redistribute - * it and/or modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either version - * 2.1 of the License, or (at your option) any later version. - * - * This file 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this code; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include <stdlib.h> - -#include "plist-utils.h" - -int plist_node_get_item_count(plist_t node) { - plist_t child; - plist_type type = PLIST_KEY; - plist_type child_type; - int count = 0; - - type = plist_get_node_type(node); - - child = plist_get_first_child(node); - if (child == NULL) - return count; - - for(child; child != NULL; child = plist_get_next_sibling(child)) { - if (type == PLIST_ARRAY) { - child_type = plist_get_node_type(child); - if ((child_type != PLIST_DICT) && (child_type != PLIST_ARRAY)) - count++; - } - else if (plist_get_node_type(child) == PLIST_KEY) { - count++; - } - } - - return count; -} - -int plist_item_index(plist_t node) { - plist_t parent; - plist_t child; - int count = 0; - - parent = plist_get_parent(node); - - if (parent == NULL || node == NULL) { - return -1; - } - - child = plist_get_first_child(parent); - while (child && child != node) { - count ++; - child = plist_get_next_sibling(child); - } - - return count; -} - diff --git a/src/plist-utils.h b/src/plist-utils.h deleted file mode 100644 index 0b25bfb..0000000 --- a/src/plist-utils.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * plist-utils.h - * - * Copyright (C) 2009 Martin Szulecki <opensuse@sukimashita.com> - * - * The code contained in this file is free software; you can redistribute - * it and/or modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either version - * 2.1 of the License, or (at your option) any later version. - * - * This file 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this code; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#ifndef _PLIST_UTILS_H -#define _PLIST_UTILS_H - -#include <plist/plist.h> - -int plist_node_get_item_count(plist_t node); -int plist_item_index(plist_t node); - -#endif |