/dev/tomkiewicz/new-smileys: c1361f7c382b: Smileys: remove old p...

Tomasz Wasilczyk twasilczyk at pidgin.im
Mon Mar 31 22:04:15 EDT 2014


Changeset: c1361f7c382b5547c3bc5d35ddbe09f214bc9087
Author:	 Tomasz Wasilczyk <twasilczyk at pidgin.im>
Date:	 2014-04-01 04:04 +0200
Branch:	 default
URL: https://hg.pidgin.im/dev/tomkiewicz/new-smileys/rev/c1361f7c382b

Description:

Smileys: remove old parsing code

diffstat:

 pidgin/Makefile.am                      |    8 +-
 pidgin/gtkconv.c                        |    8 +-
 pidgin/gtkprefs.c                       |    9 -
 pidgin/gtksmiley-theme.c                |   10 -
 pidgin/gtksmiley-theme.h                |    4 -
 pidgin/gtkthemes.c                      |  475 --------------------------------
 pidgin/gtkthemes.h                      |   70 ----
 pidgin/gtkutils.c                       |    3 -
 pidgin/gtkwebviewtoolbar.c              |   13 +-
 pidgin/libpidgin.c                      |    3 -
 pidgin/plugins/perl/common/GtkThemes.xs |   30 --
 pidgin/smileyparser.c                   |  177 -----------
 pidgin/smileyparser.h                   |   39 --
 13 files changed, 20 insertions(+), 829 deletions(-)

diffs (truncated from 1084 to 300 lines):

diff --git a/pidgin/Makefile.am b/pidgin/Makefile.am
--- a/pidgin/Makefile.am
+++ b/pidgin/Makefile.am
@@ -80,7 +80,6 @@ libpidgin_la_SOURCES = \
 	gtksound.c \
 	gtkstatus-icon-theme.c \
 	gtkstatusbox.c \
-	gtkthemes.c \
 	gtkutils.c \
 	gtkwebview.c \
 	gtkwebviewtoolbar.c \
@@ -88,8 +87,7 @@ libpidgin_la_SOURCES = \
 	gtkxfer.c \
 	libpidgin.c \
 	minidialog.c \
-	pidgintooltip.c \
-	smileyparser.c
+	pidgintooltip.c
 
 libpidgin_la_headers = \
 	gtkaccount.h \
@@ -132,7 +130,6 @@ libpidgin_la_headers = \
 	gtkstatus-icon-theme.h \
 	gtkstatusbox.h \
 	pidginstock.h \
-	gtkthemes.h \
 	gtkutils.h \
 	gtkwebview.h \
 	gtkwebviewtoolbar.h \
@@ -140,8 +137,7 @@ libpidgin_la_headers = \
 	gtkxfer.h \
 	minidialog.h \
 	pidgintooltip.h \
-	pidgin.h \
-	smileyparser.h
+	pidgin.h
 
 pidgin_SOURCES = \
 	pidgin.c
diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c
--- a/pidgin/gtkconv.c
+++ b/pidgin/gtkconv.c
@@ -60,12 +60,10 @@
 #include "gtkpounce.h"
 #include "gtkprefs.h"
 #include "gtkprivacy.h"
-#include "gtkthemes.h"
 #include "gtkutils.h"
 #include "gtkwebview.h"
 #include "pidginstock.h"
 #include "pidgintooltip.h"
-#include "smileyparser.h"
 
 #include "gtknickcolors.h"
 
@@ -6113,8 +6111,10 @@ private_gtkconv_new(PurpleConversation *
 		gtkconv->nick_colors = g_array_ref(generated_nick_colors);
 	}
 
+#if 0
 	if (purple_conversation_get_features(conv) & PURPLE_CONNECTION_FLAG_ALLOW_CUSTOM_SMILEY)
 		pidgin_themes_smiley_themeize_custom(gtkconv->entry);
+#endif
 }
 
 static void
@@ -7204,6 +7204,7 @@ pidgin_conv_has_focus(PurpleConversation
 	return FALSE;
 }
 
+#if 0
 static gboolean
 add_custom_smiley_for_webview(PidginWebView *webview, const char *sml, const char *smile)
 {
@@ -7227,10 +7228,12 @@ add_custom_smiley_for_webview(PidginWebV
 
 	return TRUE;
 }
+#endif
 
 static gboolean
 pidgin_conv_custom_smiley_add(PurpleConversation *conv, const char *smile, gboolean remote)
 {
+#if 0
 	PidginConversation *gtkconv;
 	struct PidginSmileyList *list;
 	const char *sml = NULL, *conv_sml;
@@ -7262,6 +7265,7 @@ pidgin_conv_custom_smiley_add(PurpleConv
 		if (!add_custom_smiley_for_webview(PIDGIN_WEBVIEW(gtkconv->entry), sml, smile))
 			return FALSE;
 
+#endif
 	return TRUE;
 }
 
diff --git a/pidgin/gtkprefs.c b/pidgin/gtkprefs.c
--- a/pidgin/gtkprefs.c
+++ b/pidgin/gtkprefs.c
@@ -51,7 +51,6 @@
 #include "gtksmiley-theme.h"
 #include "gtksound.h"
 #include "gtkstatus-icon-theme.h"
-#include "gtkthemes.h"
 #include "gtkutils.h"
 #include "gtkwebview.h"
 #include "pidginstock.h"
@@ -4236,7 +4235,6 @@ smiley_theme_pref_cb(const char *name, P
 
 	if (g_strcmp0(theme_name, "none") == 0) {
 		purple_smiley_theme_set_current(NULL);
-		pidgin_themes_load_smiley_theme(NULL, TRUE);
 		return;
 	}
 
@@ -4245,18 +4243,11 @@ smiley_theme_pref_cb(const char *name, P
 
 	for (it = themes; it; it = g_list_next(it)) {
 		PidginSmileyTheme *theme = it->data;
-		gchar *old_path;
 
 		if (g_strcmp0(pidgin_smiley_theme_get_name(theme), theme_name))
 			continue;
 
 		purple_smiley_theme_set_current(PURPLE_SMILEY_THEME(theme));
-
-		/* TODO: remove it */
-		old_path = g_build_filename(pidgin_smiley_theme_get_path(theme),
-			"theme", NULL);
-		pidgin_themes_load_smiley_theme(old_path, TRUE);
-		g_free(old_path);
 	}
 }
 
diff --git a/pidgin/gtksmiley-theme.c b/pidgin/gtksmiley-theme.c
--- a/pidgin/gtksmiley-theme.c
+++ b/pidgin/gtksmiley-theme.c
@@ -367,16 +367,6 @@ pidgin_smiley_theme_probe(void)
  ******************************************************************************/
 
 const gchar *
-pidgin_smiley_theme_get_path(PidginSmileyTheme *theme)
-{
-	PidginSmileyThemePrivate *priv = PIDGIN_SMILEY_THEME_GET_PRIVATE(theme);
-
-	g_return_val_if_fail(priv != NULL, NULL);
-
-	return priv->path;
-}
-
-const gchar *
 pidgin_smiley_theme_get_name(PidginSmileyTheme *theme)
 {
 	PidginSmileyThemePrivate *priv = PIDGIN_SMILEY_THEME_GET_PRIVATE(theme);
diff --git a/pidgin/gtksmiley-theme.h b/pidgin/gtksmiley-theme.h
--- a/pidgin/gtksmiley-theme.h
+++ b/pidgin/gtksmiley-theme.h
@@ -69,10 +69,6 @@ G_BEGIN_DECLS
 GType
 pidgin_smiley_theme_get_type(void);
 
-/* TODO: remove it */
-const gchar *
-pidgin_smiley_theme_get_path(PidginSmileyTheme *theme);
-
 const gchar *
 pidgin_smiley_theme_get_name(PidginSmileyTheme *theme);
 
diff --git a/pidgin/gtkthemes.c b/pidgin/gtkthemes.c
deleted file mode 100644
--- a/pidgin/gtkthemes.c
+++ /dev/null
@@ -1,475 +0,0 @@
-/*
- * Themes for Pidgin
- *
- * Pidgin 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
- *
- */
-#include "internal.h"
-#include "pidgin.h"
-
-#include "conversation.h"
-#include "debug.h"
-#include "prpl.h"
-#include "util.h"
-
-#include "gtkconv.h"
-#include "gtkdialogs.h"
-#include "gtksmiley.h"
-#include "gtkthemes.h"
-#include "gtkwebview.h"
-
-struct PidginSmileyTheme {
-	char *path;
-	char *name;
-	char *desc;
-	char *icon;
-	char *author;
-
-	struct PidginSmileyList *list;
-};
-
-GSList *smiley_themes = NULL;
-struct PidginSmileyTheme *current_smiley_theme;
-
-static void pidgin_themes_destroy_smiley_theme_smileys(struct PidginSmileyTheme *theme);
-
-gboolean pidgin_themes_smileys_disabled()
-{
-	if (!current_smiley_theme)
-		return 1;
-
-	return strcmp(current_smiley_theme->name, "none") == 0;
-}
-
-static void
-pidgin_themes_destroy_smiley_theme(struct PidginSmileyTheme *theme)
-{
-	pidgin_themes_destroy_smiley_theme_smileys(theme);
-
-	g_free(theme->name);
-	g_free(theme->desc);
-	g_free(theme->author);
-	g_free(theme->icon);
-	g_free(theme->path);
-	g_free(theme);
-}
-
-static void pidgin_themes_remove_theme_dir(const char *theme_dir_name)
-{
-	GString *str = NULL;
-	const char *file_name = NULL;
-	GDir *theme_dir = NULL;
-
-	if ((theme_dir = g_dir_open(theme_dir_name, 0, NULL)) != NULL) {
-		if ((str = g_string_new(theme_dir_name)) != NULL) {
-			while ((file_name = g_dir_read_name(theme_dir)) != NULL) {
-				g_string_printf(str, "%s%s%s", theme_dir_name, G_DIR_SEPARATOR_S, file_name);
-				g_unlink(str->str);
-			}
-			g_string_free(str, TRUE);
-		}
-		g_dir_close(theme_dir);
-		g_rmdir(theme_dir_name);
-	}
-}
-
-void pidgin_themes_remove_smiley_theme(const char *file)
-{
-	char *theme_dir = NULL, *last_slash = NULL;
-	g_return_if_fail(NULL != file);
-
-	if (!g_file_test(file, G_FILE_TEST_EXISTS)) return;
-	if ((theme_dir = g_strdup(file)) == NULL) return ;
-
-	if ((last_slash = g_strrstr(theme_dir, G_DIR_SEPARATOR_S)) != NULL) {
-		GSList *iter = NULL;
-		struct PidginSmileyTheme *theme = NULL, *new_theme = NULL;
-
-		*last_slash = 0;
-
-		/* Delete files on disk */
-		pidgin_themes_remove_theme_dir(theme_dir);
-
-		/* Find theme in themes list and remove it */
-		for (iter = smiley_themes ; iter ; iter = iter->next) {
-			theme = ((struct PidginSmileyTheme *)(iter->data));
-			if (!strcmp(theme->path, file))
-				break ;
-		}
-		if (iter) {
-			if (theme == current_smiley_theme) {
-				new_theme = ((struct PidginSmileyTheme *)(NULL == iter->next ? (smiley_themes == iter ? NULL : smiley_themes->data) : iter->next->data));
-				if (new_theme)
-					purple_prefs_set_string(PIDGIN_PREFS_ROOT "/smileys/theme", new_theme->name);
-				else
-					current_smiley_theme = NULL;
-			}
-			smiley_themes = g_slist_delete_link(smiley_themes, iter);
-
-			/* Destroy theme structure */
-			pidgin_themes_destroy_smiley_theme(theme);
-		}
-	}



More information about the Commits mailing list