[ekiga] Simplify toolbox code
- From: Eugen Dedu <ededu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ekiga] Simplify toolbox code
- Date: Mon, 26 Mar 2012 22:30:53 +0000 (UTC)
commit 6282aa63a2b6b1d8b7205d5a9505261e7468ceae
Author: Eugen Dedu <Eugen Dedu pu-pm univ-fcomte fr>
Date: Tue Mar 27 00:29:12 2012 +0200
Simplify toolbox code
lib/Makefile.am | 16 +---
lib/engine/gui/gtk-frontend/chat-area.cpp | 2 +-
lib/gmconf/gmconf-glib.c | 2 +-
lib/toolbox.c | 161 +++++++++++++++++++++++++++++
lib/{toolbox => }/toolbox.h | 0
lib/toolbox/toolbox-common.c | 89 ----------------
lib/toolbox/toolbox-gtk.c | 52 ---------
lib/toolbox/toolbox-internal.c | 72 -------------
lib/toolbox/toolbox-internal.h | 47 ---------
lib/toolbox/toolbox-win32.c | 57 ----------
src/Makefile.am | 1 -
src/gui/assistant.cpp | 2 +-
12 files changed, 166 insertions(+), 335 deletions(-)
---
diff --git a/lib/Makefile.am b/lib/Makefile.am
index d329b7b..7b18527 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -17,7 +17,6 @@ INCLUDES = \
-I$(top_srcdir)/lib \
-I$(top_srcdir)/lib/gmconf \
-I$(top_srcdir)/lib/gui \
- -I$(top_srcdir)/lib/toolbox \
-I$(top_srcdir)/lib/engine \
-I$(top_srcdir)/lib/engine/account \
-I$(top_srcdir)/lib/engine/addressbook \
@@ -79,20 +78,9 @@ gmmarshallers.h: gmmarshallers.list
gmmarshallers.c: gmmarshallers.list
$(LIBTOOL) --mode=execute glib-genmarshal --prefix=gm_marshal $^ --body > $ tmp && mv $ tmp $@
-##
-# Sources out of the toolbox directory
-##
libekiga_la_SOURCES += \
- $(top_srcdir)/lib/toolbox/toolbox.h \
- $(top_srcdir)/lib/toolbox/toolbox-common.c \
- $(top_srcdir)/lib/toolbox/toolbox-internal.h \
- $(top_srcdir)/lib/toolbox/toolbox-internal.c
-
-if WIN32
-libekiga_la_SOURCES += $(top_srcdir)/lib/toolbox/toolbox-win32.c
-else
-libekiga_la_SOURCES += $(top_srcdir)/lib/toolbox/toolbox-gtk.c
-endif
+ $(top_srcdir)/lib/toolbox.h \
+ $(top_srcdir)/lib/toolbox.c
##
# Sources out of the platform directory
diff --git a/lib/engine/gui/gtk-frontend/chat-area.cpp b/lib/engine/gui/gtk-frontend/chat-area.cpp
index 3e4bda7..9811378 100644
--- a/lib/engine/gui/gtk-frontend/chat-area.cpp
+++ b/lib/engine/gui/gtk-frontend/chat-area.cpp
@@ -45,7 +45,7 @@
#include "gm-smiley-chooser-button.h"
#include "gm-smileys.h"
-#include "toolbox/toolbox.h"
+#include "toolbox.h"
#include <string.h>
#include <stdarg.h>
diff --git a/lib/gmconf/gmconf-glib.c b/lib/gmconf/gmconf-glib.c
index a73f353..78bbb47 100644
--- a/lib/gmconf/gmconf-glib.c
+++ b/lib/gmconf/gmconf-glib.c
@@ -43,7 +43,7 @@
#include <string.h>
#include <sys/stat.h>
-#include "toolbox/toolbox.h"
+#include "toolbox.h"
#include "gmconf.h"
#ifdef WIN32
diff --git a/lib/toolbox.c b/lib/toolbox.c
new file mode 100644
index 0000000..0c3c02d
--- /dev/null
+++ b/lib/toolbox.c
@@ -0,0 +1,161 @@
+
+/* Ekiga -- A VoIP and Video-Conferencing application
+ * Copyright (C) 2000-2009 Damien Sandras <dsandras seconix com>
+ *
+ * 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 St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *
+ * Ekiga is licensed under the GPL license and as a special exception,
+ * you have permission to link or otherwise combine this program with the
+ * programs OPAL, OpenH323 and PWLIB, and distribute the combination,
+ * without applying the requirements of the GNU GPL to the OPAL, OpenH323
+ * and PWLIB programs, as long as you do follow the requirements of the
+ * GNU GPL for all the rest of the software thus combined.
+ */
+
+
+/*
+ * toolbox.c - description
+ * ------------------------------------------
+ * begin : Dec 2005
+ * copyright : (C) 2005 by Julien Puydt
+ * description : Various helper functions
+ */
+
+#include "toolbox.h"
+#include <string.h>
+
+#ifndef WIN32
+#include <gtk/gtk.h>
+#else
+#include <windows.h>
+#endif
+
+#ifndef WIN32
+static void
+gm_open_uri_fallback (const gchar *uri)
+{
+ gchar *commandline = NULL;
+ gboolean success = FALSE;
+
+ if (!success && g_getenv("KDE_FULL_SESSION") != NULL) {
+
+ commandline = g_strdup_printf ("kfmclient exec %s", uri);
+ success = g_spawn_command_line_async (commandline, NULL);
+ g_free (commandline);
+ }
+
+ if (!success) {
+
+ commandline = g_strdup_printf ("sensible-browser %s", uri);
+ success = g_spawn_command_line_async (commandline, NULL);
+ g_free (commandline);
+ }
+
+ if (!success) {
+
+ commandline = g_strdup_printf ("firefox %s", uri);
+ success = g_spawn_command_line_async (commandline, NULL);
+ g_free (commandline);
+ }
+
+ if (!success) {
+
+ commandline = g_strdup_printf ("konqueror %s", uri);
+ success = g_spawn_command_line_async (commandline, NULL);
+ g_free (commandline);
+ }
+}
+
+void
+gm_open_uri (const gchar *uri)
+{
+ GError *error = NULL;
+
+ g_return_if_fail (uri != NULL);
+
+ if (!gtk_show_uri (NULL, uri, GDK_CURRENT_TIME, &error)) {
+ g_error_free (error);
+ gm_open_uri_fallback (uri);
+ }
+}
+
+#else
+
+void
+gm_open_uri (const gchar *uri)
+{
+ SHELLEXECUTEINFO sinfo;
+
+ g_return_if_fail (uri != NULL);
+
+ memset (&sinfo, 0, sizeof (sinfo));
+ sinfo.cbSize = sizeof (sinfo);
+ sinfo.fMask = SEE_MASK_CLASSNAME;
+ sinfo.lpVerb = "open";
+ sinfo.lpFile = uri;
+ sinfo.nShow = SW_SHOWNORMAL;
+ sinfo.lpClass = "http";
+
+ (void)ShellExecuteEx (&sinfo); /* leave out any error */
+}
+
+#endif
+
+GSList
+*gm_string_gslist_remove_dups (GSList *origlist)
+{
+ /* from a GSList* of gchar*, remove all dup strings
+ * (C) Jan Schampera <jan schampera web de> */
+ GSList *origlist_iter = NULL;
+ GSList *seenlist = NULL;
+ GSList *seenlist_iter = NULL;
+ gboolean seen = FALSE;
+
+ /* iterate through the original list and compare every stored gchar* to
+ * our "seen list", if not there, append it */
+ if (!origlist) return NULL;
+
+ for (origlist_iter = origlist;
+ origlist_iter != NULL;
+ origlist_iter = g_slist_next (origlist_iter))
+ {
+ if (origlist_iter->data)
+ {
+ seen = FALSE;
+ /* check if the string is already in the "seen list" */
+ for (seenlist_iter = seenlist;
+ seenlist_iter != NULL;
+ seenlist_iter = g_slist_next (seenlist_iter))
+ {
+ if (seenlist_iter->data &&
+ !strcmp ((const char*) origlist_iter->data,
+ (const char*) seenlist_iter->data))
+ seen = TRUE;
+ }
+ if (!seen)
+ /* not in list? append it... */
+ seenlist = g_slist_append (seenlist,
+ (gpointer) g_strdup
+ ((const gchar*) origlist_iter->data));
+ }
+ }
+
+ /* free the memory of the original list */
+ g_slist_foreach (origlist, (GFunc) g_free, NULL);
+ g_slist_free (origlist);
+
+ return seenlist;
+}
diff --git a/lib/toolbox/toolbox.h b/lib/toolbox.h
similarity index 100%
rename from lib/toolbox/toolbox.h
rename to lib/toolbox.h
diff --git a/src/Makefile.am b/src/Makefile.am
index a0ae0c3..a8d2b2f 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,7 +1,6 @@
INCLUDES = \
-I$(top_srcdir)/lib \
-I$(top_srcdir)/lib/gmconf \
- -I$(top_srcdir)/lib/toolbox \
-I$(top_srcdir)/lib/gui \
-I$(top_srcdir)/lib/engine/ \
-I$(top_srcdir)/lib/engine/framework \
diff --git a/src/gui/assistant.cpp b/src/gui/assistant.cpp
index c805bff..1f05f8b 100644
--- a/src/gui/assistant.cpp
+++ b/src/gui/assistant.cpp
@@ -44,7 +44,7 @@
#include "ekiga.h"
#include "gmconf.h"
-#include "toolbox/toolbox.h"
+#include "toolbox.h"
#include "assistant.h"
#include "default_devices.h"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]