1 /* 2 * Nautilus-Actions 3 * A Nautilus extension which offers configurable context menu actions. 4 * 5 * Copyright (C) 2005 The GNOME Foundation 6 * Copyright (C) 2006-2008 Frederic Ruaudel and others (see AUTHORS) 7 * Copyright (C) 2009-2014 Pierre Wieser and others (see AUTHORS) 8 * 9 * Nautilus-Actions is free software; you can redistribute it and/or 10 * modify it under the terms of the GNU General Public License as 11 * published by the Free Software Foundation; either version 2 of 12 * the License, or (at your option) any later version. 13 * 14 * Nautilus-Actions is distributed in the hope that it will be useful, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 * General Public License for more details. 18 * 19 * You should have received a copy of the GNU General Public License 20 * along with Nautilus-Actions; see the file COPYING. If not, see 21 * <http://www.gnu.org/licenses/>. 22 * 23 * Authors: 24 * Frederic Ruaudel <grumz@grumz.net> 25 * Rodrigo Moya <rodrigo@gnome-db.org> 26 * Pierre Wieser <pwieser@trychlos.org> 27 * ... and many others (see AUTHORS) 28 */ 29 30 #ifndef __NAUTILUS_ACTIONS_API_NA_CORE_UTILS_H__ 31 #define __NAUTILUS_ACTIONS_API_NA_CORE_UTILS_H__ 32 33 /** 34 * SECTION: core-utils 35 * @title: Core Misc 36 * @short_description: The Core Library Utilities 37 * @include: nautilus-action/na-core-utils.h 38 */ 39 40 #include <glib.h> 41 42 G_BEGIN_DECLS 43 44 /* boolean manipulation 45 */ 46 gboolean na_core_utils_boolean_from_string( const gchar *string ); 47 48 /* string manipulation 49 */ 50 #ifdef NA_ENABLE_DEPRECATED 51 gchar *na_core_utils_str_add_prefix( const gchar *prefix, const gchar *str ); 52 #endif 53 int na_core_utils_str_collate( const gchar *str1, const gchar *str2 ); 54 gchar *na_core_utils_str_remove_char( const gchar *string, const gchar *to_remove ); 55 gchar *na_core_utils_str_remove_suffix( const gchar *string, const gchar *suffix ); 56 void na_core_utils_str_split_first_word( const gchar *string, gchar **first, gchar **other ); 57 gchar *na_core_utils_str_subst( const gchar *pattern, const gchar *key, const gchar *subst ); 58 59 /* some functions to get or set GSList list of strings 60 */ 61 void na_core_utils_slist_add_message( GSList **list, const gchar *format, ... ); 62 GSList *na_core_utils_slist_duplicate( GSList *slist ); 63 void na_core_utils_slist_dump( const gchar *prefix, GSList *list ); 64 GSList *na_core_utils_slist_from_array( const gchar **str_array ); 65 GSList *na_core_utils_slist_from_split( const gchar *text, const gchar *separator ); 66 gchar *na_core_utils_slist_join_at_end( GSList *slist, const gchar *link ); 67 GSList *na_core_utils_slist_remove_ascii( GSList *slist, const gchar *text ); 68 GSList *na_core_utils_slist_remove_utf8( GSList *slist, const gchar *text ); 69 gchar **na_core_utils_slist_to_array( GSList *slist ); 70 gchar *na_core_utils_slist_to_text( GSList *slist ); 71 GSList *na_core_utils_slist_setup_element( GSList *list, const gchar *element, gboolean set ); 72 guint na_core_utils_slist_count( GSList *list, const gchar *str ); 73 gboolean na_core_utils_slist_find_negated( GSList *list, const gchar *str ); 74 gboolean na_core_utils_slist_are_equal( GSList *a, GSList *b ); 75 void na_core_utils_slist_free( GSList *slist ); 76 77 /* some functions for GString manipulations. 78 */ 79 gchar *na_core_utils_gstring_joinv( const gchar *start, const gchar *separator, gchar **list ); 80 81 /* selection count 82 */ 83 void na_core_utils_selcount_get_ope_int( const gchar *selection_count, gchar **ope, gchar **uint ); 84 85 /* directory management 86 */ 87 gboolean na_core_utils_dir_is_writable_path( const gchar *path ); 88 gboolean na_core_utils_dir_is_writable_uri ( const gchar *uri ); 89 void na_core_utils_dir_list_perms ( const gchar *path, const gchar *message ); 90 void na_core_utils_dir_split_ext ( const gchar *string, gchar **first, gchar **ext ); 91 92 /* file management 93 */ 94 gboolean na_core_utils_file_delete ( const gchar *path ); 95 gboolean na_core_utils_file_exists ( const gchar *uri ); 96 gboolean na_core_utils_file_is_loadable ( const gchar *uri ); 97 void na_core_utils_file_list_perms ( const gchar *path, const gchar *message ); 98 gchar *na_core_utils_file_load_from_uri( const gchar *uri, gsize *length ); 99 100 /* miscellaneous 101 */ 102 void na_core_utils_print_version( void ); 103 104 G_END_DECLS 105 106 #endif /* __NAUTILUS_ACTIONS_API_NA_CORE_UTILS_H__ */ 107