/pidgin/main: c8fbf4540fac: Remove PurpleDesktopItem for good
Jorge Villase?or <[email protected]>
| Newsgroups | gmane.comp.gnome.gaim.cvs |
|---|---|
| Message-ID | <[email protected]> |
Changeset: c8fbf4540face4e784b2e300bd62898265a50543 Author: Jorge Villase?or <[email protected]> Date: 2016-01-19 00:12 -0800 Branch: default URL: https://hg.pidgin.im/pidgin/main/rev/c8fbf4540fac Description: Remove PurpleDesktopItem for good We can use glib's utilities to parse this file when needed. diffstat: doc/reference/libpurple/libpurple-docs.xml | 1 - libpurple/Makefile.am | 2 - libpurple/desktopitem.c | 1270 ---------------------------- libpurple/desktopitem.h | 178 --- libpurple/purple.h.in | 1 - 5 files changed, 0 insertions(+), 1452 deletions(-) diffs (truncated from 1499 to 300 lines): diff --git a/doc/reference/libpurple/libpurple-docs.xml b/doc/reference/libpurple/libpurple-docs.xml --- a/doc/reference/libpurple/libpurple-docs.xml +++ b/doc/reference/libpurple/libpurple-docs.xml @@ -52,7 +52,6 @@ <xi:include href="xml/idle.xml" /> <xi:include href="xml/keyring.xml" /> <xi:include href="xml/memorypool.xml" /> - <xi:include href="xml/desktopitem.xml" /> <xi:include href="xml/mime.xml" /> <xi:include href="xml/nat-pmp.xml" /> <xi:include href="xml/network.xml" /> diff --git a/libpurple/Makefile.am b/libpurple/Makefile.am --- a/libpurple/Makefile.am +++ b/libpurple/Makefile.am @@ -63,7 +63,6 @@ purple_coresources = \ conversations.c \ core.c \ debug.c \ - desktopitem.c \ e2ee.c \ eventloop.c \ http.c \ @@ -147,7 +146,6 @@ purple_coreheaders = \ core.h \ dbus-maybe.h \ debug.h \ - desktopitem.h \ e2ee.h \ eventloop.h \ http.h \ diff --git a/libpurple/desktopitem.c b/libpurple/desktopitem.c deleted file mode 100644 --- a/libpurple/desktopitem.c +++ /dev/null @@ -1,1270 +0,0 @@ -/* Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -/* - * The following code has been adapted from gnome-desktop-item.[ch], - * as found on gnome-desktop-2.8.1. - * - * Copyright (C) 2004 by Alceste Scalas <[email protected]>. - * - * Original copyright notice: - * - * Copyright (C) 1999, 2000 Red Hat Inc. - * Copyright (C) 2001 Sid Vicious - * All rights reserved. - * - * This file is part of the Gnome Library. - * - * The Gnome Library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * The Gnome Library 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with the Gnome Library; see the file COPYING.LIB. If not, - * write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02111-1301, USA. - */ - -#include "internal.h" -#include <errno.h> -#include <stdio.h> -#include <string.h> -#include <time.h> -#include "desktopitem.h" - -struct _PurpleDesktopItem { - int refcount; - - /* all languages used */ - GList *languages; - - PurpleDesktopItemType type; - - /* `modified' means that the ditem has been - * modified since the last save. */ - gboolean modified; - - /* Keys of the main section only */ - GList *keys; - - GList *sections; - - /* This includes ALL keys, including - * other sections, separated by '/' */ - GHashTable *main_hash; - - char *location; - - time_t mtime; -}; - -typedef struct { - char *name; - GList *keys; -} Section; - -typedef enum { - ENCODING_UNKNOWN, - ENCODING_UTF8, - ENCODING_LEGACY_MIXED -} Encoding; - -/************************************************************************** - * Private utility functions - **************************************************************************/ -static PurpleDesktopItemType -type_from_string (const char *type) -{ - if (!type) - return PURPLE_DESKTOP_ITEM_TYPE_NULL; - - switch (type [0]) { - case 'A': - if (purple_strequal (type, "Application")) - return PURPLE_DESKTOP_ITEM_TYPE_APPLICATION; - break; - case 'L': - if (purple_strequal (type, "Link")) - return PURPLE_DESKTOP_ITEM_TYPE_LINK; - break; - case 'F': - if (purple_strequal (type, "FSDevice")) - return PURPLE_DESKTOP_ITEM_TYPE_FSDEVICE; - break; - case 'M': - if (purple_strequal (type, "MimeType")) - return PURPLE_DESKTOP_ITEM_TYPE_MIME_TYPE; - break; - case 'D': - if (purple_strequal (type, "Directory")) - return PURPLE_DESKTOP_ITEM_TYPE_DIRECTORY; - break; - case 'S': - if (purple_strequal (type, "Service")) - return PURPLE_DESKTOP_ITEM_TYPE_SERVICE; - - else if (purple_strequal (type, "ServiceType")) - return PURPLE_DESKTOP_ITEM_TYPE_SERVICE_TYPE; - break; - default: - break; - } - - return PURPLE_DESKTOP_ITEM_TYPE_OTHER; -} - -static Section * -find_section (PurpleDesktopItem *item, const char *section) -{ - GList *li; - Section *sec; - - if (section == NULL) - return NULL; - if (purple_strequal (section, "Desktop Entry")) - return NULL; - - for (li = item->sections; li != NULL; li = li->next) { - sec = li->data; - if (purple_strequal (sec->name, section)) - return sec; - } - - sec = g_new0 (Section, 1); - sec->name = g_strdup (section); - sec->keys = NULL; - - item->sections = g_list_append (item->sections, sec); - - /* Don't mark the item modified, this is just an empty section, - * it won't be saved even */ - - return sec; -} - -static Section * -section_from_key (PurpleDesktopItem *item, const char *key) -{ - char *p; - char *name; - Section *sec; - - if (key == NULL) - return NULL; - - p = strchr (key, '/'); - if (p == NULL) - return NULL; - - name = g_strndup (key, p - key); - - sec = find_section (item, name); - - g_free (name); - - return sec; -} - -static const char * -key_basename (const char *key) -{ - char *p = strrchr (key, '/'); - if (p != NULL) - return p+1; - else - return key; -} - -static void -set (PurpleDesktopItem *item, const char *key, const char *value) -{ - Section *sec = section_from_key (item, key); - - if (sec != NULL) { - if (value != NULL) { - if (g_hash_table_lookup (item->main_hash, key) == NULL) - sec->keys = g_list_append - (sec->keys, - g_strdup (key_basename (key))); - - g_hash_table_replace (item->main_hash, - g_strdup (key), - g_strdup (value)); - } else { - GList *list = g_list_find_custom - (sec->keys, key_basename (key), - (GCompareFunc)strcmp); - if (list != NULL) { - g_free (list->data); - sec->keys = - g_list_delete_link (sec->keys, list); - } - g_hash_table_remove (item->main_hash, key); - } - } else { - if (value != NULL) { - if (g_hash_table_lookup (item->main_hash, key) == NULL) - item->keys = g_list_append (item->keys, - g_strdup (key)); - - g_hash_table_replace (item->main_hash, - g_strdup (key), - g_strdup (value)); - } else { - GList *list = g_list_find_custom - (item->keys, key, (GCompareFunc)strcmp); - if (list != NULL) { - g_free (list->data); - item->keys = - g_list_delete_link (item->keys, list); - } - g_hash_table_remove (item->main_hash, key); - } - } - item->modified = TRUE; -} - - -static void -_purple_desktop_item_set_string (PurpleDesktopItem *item, - const char *attr, - const char *value) -{ - g_return_if_fail (item != NULL); - g_return_if_fail (item->refcount > 0); - g_return_if_fail (attr != NULL); - - set (item, attr, value); - - if (purple_strequal (attr, PURPLE_DESKTOP_ITEM_TYPE)) - item->type = type_from_string (value); -} - _______________________________________________ Commits mailing list [email protected] https://pidgin.im/cgi-bin/mailman/listinfo/commits