From 8762e136d5d90f37598c9bfb84f08511474d5915 Mon Sep 17 00:00:00 2001
From: Tristan Matthews <tristan.matthews@savoirfairelinux.com>
Date: Tue, 18 Oct 2011 13:01:03 -0400
Subject: [PATCH] refactor some code out of sflphone_const.h

---
 gnome/src/Makefile.am                      |  2 +-
 gnome/src/accountlist.c                    |  5 ++--
 gnome/src/config/accountconfigdialog.c     |  1 +
 gnome/src/config/accountlistconfigdialog.c |  1 +
 gnome/src/config/addressbook-config.c      |  1 +
 gnome/src/config/assistant.c               |  1 +
 gnome/src/config/audioconf.c               |  1 +
 gnome/src/config/preferencesdialog.c       |  1 +
 gnome/src/config/shortcuts-config.c        |  1 +
 gnome/src/contacts/calllist.c              |  2 +-
 gnome/src/contacts/calltree.c              |  1 +
 gnome/src/contacts/history.c               |  7 +++--
 gnome/src/contacts/searchbar.c             |  1 +
 gnome/src/dbus/dbus.c                      |  1 +
 gnome/src/dialpad.c                        |  1 +
 gnome/src/eel-gconf-extensions.h           | 22 ++++++++++++++
 gnome/src/imwindow.c                       |  3 +-
 gnome/src/mainwindow.c                     |  1 +
 gnome/src/sflphone_const.h                 | 27 -----------------
 gnome/src/shortcuts.c                      |  1 +
 gnome/src/statusicon.c                     |  1 +
 gnome/src/uimanager.c                      |  1 +
 gnome/src/unused.h                         | 35 ++++++++++++++++++++++
 gnome/src/widget/gtkscrollbook.c           |  1 +
 gnome/src/widget/imwidget.c                |  2 +-
 gnome/src/widget/minidialog.c              |  1 +
 26 files changed, 86 insertions(+), 36 deletions(-)
 create mode 100644 gnome/src/unused.h

diff --git a/gnome/src/Makefile.am b/gnome/src/Makefile.am
index 778f6d3e09..3348f1b2d7 100644
--- a/gnome/src/Makefile.am
+++ b/gnome/src/Makefile.am
@@ -32,7 +32,7 @@ sflphone_client_gnome_SOURCES = \
 noinst_HEADERS =  actions.h sflnotify.h mainwindow.h dialpad.h codeclist.h \
                   reqaccount.h sflphone_const.h uimanager.h \
                   accountlist.h sliders.h statusicon.h callable_obj.h conference_obj.h \
-                  shortcuts.h eel-gconf-extensions.h logger.h imwindow.h
+                  shortcuts.h eel-gconf-extensions.h logger.h imwindow.h unused.h
 
 sflphone_client_gnome_LDADD = $(DBUSGLIB_LIBS) $(LIBNOTIFY_LIBS) $(NOTIFY_LIBS) $(SFLPHONEGTK_LIBS) $(X11_LIBS) \
 				$(GTK_LIBS) $(GLIB_LIBS) $(WEBKIT_LIBS) $(LIBGNOMEUI_LIBS) $(GNOMEDOCUTILS_LIBS) $(LD_LIBS)
diff --git a/gnome/src/accountlist.c b/gnome/src/accountlist.c
index 83e6d171b6..662c7bc872 100644
--- a/gnome/src/accountlist.c
+++ b/gnome/src/accountlist.c
@@ -29,8 +29,9 @@
  *  as that of the covered work.
  */
 
-#include <accountlist.h>
-#include <actions.h>
+#include "accountlist.h"
+#include "actions.h"
+#include "unused.h"
 
 static GQueue * accountQueue;
 
diff --git a/gnome/src/config/accountconfigdialog.c b/gnome/src/config/accountconfigdialog.c
index fcf744c69e..2e5f08d666 100644
--- a/gnome/src/config/accountconfigdialog.c
+++ b/gnome/src/config/accountconfigdialog.c
@@ -50,6 +50,7 @@
 #include "audioconf.h"
 #include "dbus/dbus.h"
 #include "utils.h"
+#include "unused.h"
 
 /**
  * TODO: tidy this up
diff --git a/gnome/src/config/accountlistconfigdialog.c b/gnome/src/config/accountlistconfigdialog.c
index d2ec3fb185..47d7aa86b7 100644
--- a/gnome/src/config/accountlistconfigdialog.c
+++ b/gnome/src/config/accountlistconfigdialog.c
@@ -36,6 +36,7 @@
 #include "actions.h"
 #include "mainwindow.h"
 #include "utils.h"
+#include "unused.h"
 #include "logger.h"
 #include <string.h>
 #include <libgnome/gnome-help.h>
diff --git a/gnome/src/config/addressbook-config.c b/gnome/src/config/addressbook-config.c
index e640dbca59..9abbd3cc6b 100644
--- a/gnome/src/config/addressbook-config.c
+++ b/gnome/src/config/addressbook-config.c
@@ -30,6 +30,7 @@
 
 #include "addressbook-config.h"
 #include "dbus.h"
+#include "unused.h"
 #include "logger.h"
 #include "searchbar.h"
 #include "contacts/addrbookfactory.h"
diff --git a/gnome/src/config/assistant.c b/gnome/src/config/assistant.c
index 57d5aec747..d3755dbe21 100644
--- a/gnome/src/config/assistant.c
+++ b/gnome/src/config/assistant.c
@@ -30,6 +30,7 @@
 
 #include <string.h>
 
+#include "unused.h"
 #include "assistant.h"
 #include "logger.h"
 #include "dbus.h"
diff --git a/gnome/src/config/audioconf.c b/gnome/src/config/audioconf.c
index 96fb3e1d8f..77fe694fde 100644
--- a/gnome/src/config/audioconf.c
+++ b/gnome/src/config/audioconf.c
@@ -36,6 +36,7 @@
 #include "dbus/dbus.h"
 #include "uimanager.h"
 #include "mainwindow.h"
+#include "unused.h"
 
 /* FIXME: these should be in a struct rather than at file scope */
 static GtkListStore *pluginlist;
diff --git a/gnome/src/config/preferencesdialog.c b/gnome/src/config/preferencesdialog.c
index 67c1d4d065..52393533ef 100644
--- a/gnome/src/config/preferencesdialog.c
+++ b/gnome/src/config/preferencesdialog.c
@@ -48,6 +48,7 @@
 #include "hooks-config.h"
 #include "audioconf.h"
 #include "uimanager.h"
+#include "unused.h"
 #include "mainwindow.h"
 
 /**
diff --git a/gnome/src/config/shortcuts-config.c b/gnome/src/config/shortcuts-config.c
index 8b1932baac..ba3fc72ff9 100644
--- a/gnome/src/config/shortcuts-config.c
+++ b/gnome/src/config/shortcuts-config.c
@@ -30,6 +30,7 @@
 
 #include "shortcuts-config.h"
 #include "shortcuts.h"
+#include "unused.h"
 #include "logger.h"
 
 #include <gdk/gdkx.h>
diff --git a/gnome/src/contacts/calllist.c b/gnome/src/contacts/calllist.c
index 76f74d61b6..fd20bec21c 100644
--- a/gnome/src/contacts/calllist.c
+++ b/gnome/src/contacts/calllist.c
@@ -31,8 +31,8 @@
 #include "calllist.h"
 #include "calltab.h"
 #include "calltree.h"
+#include "unused.h"
 #include "logger.h"
-#include "contacts/searchbar.h"
 #include "eel-gconf-extensions.h"
 
 static
diff --git a/gnome/src/contacts/calltree.c b/gnome/src/contacts/calltree.c
index 17961c6bc8..c1abb7d000 100644
--- a/gnome/src/contacts/calltree.c
+++ b/gnome/src/contacts/calltree.c
@@ -36,6 +36,7 @@
 #include <glib/gprintf.h>
 
 #include "eel-gconf-extensions.h"
+#include "unused.h"
 #include "dbus.h"
 #include "calltab.h"
 #include "logger.h"
diff --git a/gnome/src/contacts/history.c b/gnome/src/contacts/history.c
index e311978e46..36cd0a2ac4 100644
--- a/gnome/src/contacts/history.c
+++ b/gnome/src/contacts/history.c
@@ -28,10 +28,11 @@
  *  as that of the covered work.
  */
 
-#include <history.h>
 #include <string.h>
-#include <searchbar.h>
-#include <calltab.h>
+#include "history.h"
+#include "searchbar.h"
+#include "calltab.h"
+#include "unused.h"
 
 static GtkTreeModel *history_filter;
 static GtkEntry *history_searchbar_widget;
diff --git a/gnome/src/contacts/searchbar.c b/gnome/src/contacts/searchbar.c
index aa39c8d739..6a14a7e18d 100644
--- a/gnome/src/contacts/searchbar.c
+++ b/gnome/src/contacts/searchbar.c
@@ -36,6 +36,7 @@
 #include "calltab.h"
 #include "dbus.h"
 #include "logger.h"
+#include "unused.h"
 #include "config/addressbook-config.h"
 #include "contacts/addressbook.h"
 #include "contacts/addrbookfactory.h"
diff --git a/gnome/src/dbus/dbus.c b/gnome/src/dbus/dbus.c
index 9980fb297d..3ff02aa021 100644
--- a/gnome/src/dbus/dbus.c
+++ b/gnome/src/dbus/dbus.c
@@ -46,6 +46,7 @@
 
 #include "dbus.h"
 #include "actions.h"
+#include "unused.h"
 
 #include "widget/imwidget.h"
 
diff --git a/gnome/src/dialpad.c b/gnome/src/dialpad.c
index c7a02b988a..0ae6f52797 100644
--- a/gnome/src/dialpad.c
+++ b/gnome/src/dialpad.c
@@ -31,6 +31,7 @@
 #include "dialpad.h"
 #include "actions.h"
 #include "calltab.h"
+#include "unused.h"
 
 /**
  * button pressed event
diff --git a/gnome/src/eel-gconf-extensions.h b/gnome/src/eel-gconf-extensions.h
index f9e4f5c381..0068b15b2f 100644
--- a/gnome/src/eel-gconf-extensions.h
+++ b/gnome/src/eel-gconf-extensions.h
@@ -32,6 +32,28 @@
 #ifdef __cplusplus
 BEGIN_EXTERN_C
 #endif
+/**
+ * Gconf
+ */
+#define CONF_PREFIX		"/apps/sflphone-client-gnome"
+#define CONF_MAIN_WINDOW_WIDTH		CONF_PREFIX "/state/window_width"
+#define CONF_MAIN_WINDOW_HEIGHT		CONF_PREFIX "/state/window_height"
+#define CONF_MAIN_WINDOW_POSITION_X		CONF_PREFIX "/state/window_position_x"
+#define CONF_MAIN_WINDOW_POSITION_Y		CONF_PREFIX "/state/window_position_y"
+#define CONF_IM_WINDOW_WIDTH		CONF_PREFIX "/state/im_width"
+#define CONF_IM_WINDOW_HEIGHT		CONF_PREFIX "/state/im_height"
+#define CONF_IM_WINDOW_POSITION_X		CONF_PREFIX "/state/im_position_x"
+#define CONF_IM_WINDOW_POSITION_Y		CONF_PREFIX "/state/im_position_y"
+/** Show/Hide the dialpad */
+#define CONF_SHOW_DIALPAD			CONF_PREFIX "/state/dialpad"
+#define SHOW_VOLUME_CONTROLS		CONF_PREFIX "/state/volume_controls"
+#define SHOW_STATUSICON				CONF_PREFIX "/state/statusicon"
+#define NOTIFY_ALL					CONF_PREFIX "/state/notify_all"
+#define START_HIDDEN				CONF_PREFIX "/state/start_hidden"
+#define POPUP_ON_CALL				CONF_PREFIX "/state/popup"
+#define HISTORY_ENABLED				CONF_PREFIX "/state/history"
+#define INSTANT_MESSAGING_ENABLED               CONF_PREFIX "/state/instant_messaging"
+
 
 #define EEL_GCONF_UNDEFINED_CONNECTION 0
 
diff --git a/gnome/src/imwindow.c b/gnome/src/imwindow.c
index 32940ff323..43d8608033 100644
--- a/gnome/src/imwindow.c
+++ b/gnome/src/imwindow.c
@@ -32,11 +32,12 @@
 
 #include "config.h"
 #include "eel-gconf-extensions.h"
-#include "sflphone_const.h"
 #include "logger.h"
 #include "imwindow.h"
+#include "unused.h"
 #include "contacts/calltab.h"
 #include "contacts/calltab.h"
+#include "sflphone_const.h"
 #include <sys/stat.h>
 
 /** Local variables */
diff --git a/gnome/src/mainwindow.c b/gnome/src/mainwindow.c
index dd1b1c3160..eea520d9f4 100644
--- a/gnome/src/mainwindow.c
+++ b/gnome/src/mainwindow.c
@@ -46,6 +46,7 @@
 #include "widget/gtkscrollbook.h"
 #include "widget/minidialog.h"
 #include "uimanager.h"
+#include "unused.h"
 #include "config/audioconf.h"
 
 #include <sys/stat.h>
diff --git a/gnome/src/sflphone_const.h b/gnome/src/sflphone_const.h
index 5f36e3f202..fd7cec91d2 100644
--- a/gnome/src/sflphone_const.h
+++ b/gnome/src/sflphone_const.h
@@ -55,11 +55,6 @@
 
 #define IP2IP	"IP2IP"
 
-/** Warnings unused variables **/
-#define UNUSED_VAR(var)      (void*)var
-
-#define UNUSED  __attribute__((__unused__))
-
 #define IP2IP_PROFILE                      "IP2IP"
 
 #define ACCOUNT_ID                         "Account.id"
@@ -170,26 +165,4 @@
 /** Desktop notifications - Time before to close the notification*/
 #define __TIMEOUT_TIME      18000       // 30 secondes
 
-/**
- * Gconf
- */
-#define CONF_PREFIX		"/apps/sflphone-client-gnome"
-#define CONF_MAIN_WINDOW_WIDTH		CONF_PREFIX "/state/window_width"
-#define CONF_MAIN_WINDOW_HEIGHT		CONF_PREFIX "/state/window_height"
-#define CONF_MAIN_WINDOW_POSITION_X		CONF_PREFIX "/state/window_position_x"
-#define CONF_MAIN_WINDOW_POSITION_Y		CONF_PREFIX "/state/window_position_y"
-#define CONF_IM_WINDOW_WIDTH		CONF_PREFIX "/state/im_width"
-#define CONF_IM_WINDOW_HEIGHT		CONF_PREFIX "/state/im_height"
-#define CONF_IM_WINDOW_POSITION_X		CONF_PREFIX "/state/im_position_x"
-#define CONF_IM_WINDOW_POSITION_Y		CONF_PREFIX "/state/im_position_y"
-/** Show/Hide the dialpad */
-#define CONF_SHOW_DIALPAD			CONF_PREFIX "/state/dialpad"
-#define SHOW_VOLUME_CONTROLS		CONF_PREFIX "/state/volume_controls"
-#define SHOW_STATUSICON				CONF_PREFIX "/state/statusicon"
-#define NOTIFY_ALL					CONF_PREFIX "/state/notify_all"
-#define START_HIDDEN				CONF_PREFIX "/state/start_hidden"
-#define POPUP_ON_CALL				CONF_PREFIX "/state/popup"
-#define HISTORY_ENABLED				CONF_PREFIX "/state/history"
-#define INSTANT_MESSAGING_ENABLED               CONF_PREFIX "/state/instant_messaging"
-
 #endif
diff --git a/gnome/src/shortcuts.c b/gnome/src/shortcuts.c
index 737b917a91..014e4298d3 100644
--- a/gnome/src/shortcuts.c
+++ b/gnome/src/shortcuts.c
@@ -46,6 +46,7 @@
 #include "sflphone_const.h"
 #include "dbus.h"
 #include "actions.h"
+#include "unused.h"
 
 static void
 ungrab_key(guint key, GdkModifierType mask, const GdkWindow *root);
diff --git a/gnome/src/statusicon.c b/gnome/src/statusicon.c
index aac67c039c..60e12a1867 100644
--- a/gnome/src/statusicon.c
+++ b/gnome/src/statusicon.c
@@ -36,6 +36,7 @@
 #include "statusicon.h"
 #include "eel-gconf-extensions.h"
 #include "logger.h"
+#include "unused.h"
 
 static GtkStatusIcon *status;
 static GtkWidget *show_menu_item, *hangup_menu_item;
diff --git a/gnome/src/uimanager.c b/gnome/src/uimanager.c
index f4aded2fd6..1030d2826b 100644
--- a/gnome/src/uimanager.c
+++ b/gnome/src/uimanager.c
@@ -45,6 +45,7 @@
 #include "eel-gconf-extensions.h"
 
 #include "config/audioconf.h"
+#include "unused.h"
 #include "uimanager.h"
 #include "statusicon.h"
 
diff --git a/gnome/src/unused.h b/gnome/src/unused.h
new file mode 100644
index 0000000000..24a0ac2e40
--- /dev/null
+++ b/gnome/src/unused.h
@@ -0,0 +1,35 @@
+/*
+ *  Copyright (C) 2004, 2005, 2006, 2008, 2009, 2010, 2011 Savoir-Faire Linux Inc.
+ *  Author: Tristan Matthews <tristan.matthews@savoirfairelinux.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 3 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ *  Additional permission under GNU GPL version 3 section 7:
+ *
+ *  If you modify this program, or any covered work, by linking or
+ *  combining it with the OpenSSL project's OpenSSL library (or a
+ *  modified version of that library), containing parts covered by the
+ *  terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
+ *  grants you additional permission to convey the resulting work.
+ *  Corresponding Source for a non-source form of such a combination
+ *  shall include the source code for the parts of OpenSSL used as well
+ *  as that of the covered work.
+ */
+
+#ifndef UNUSED_H_
+
+#define UNUSED  __attribute__((__unused__)) 
+
+#endif /* UNUSED_H_ */
diff --git a/gnome/src/widget/gtkscrollbook.c b/gnome/src/widget/gtkscrollbook.c
index c18f2c3aa0..0e8d5e9556 100644
--- a/gnome/src/widget/gtkscrollbook.c
+++ b/gnome/src/widget/gtkscrollbook.c
@@ -25,6 +25,7 @@
  */
 
 #include "gtkscrollbook.h"
+#include "unused.h"
 #include "sflphone_const.h"
 
 static void pidgin_scroll_book_init(PidginScrollBook *scroll_book);
diff --git a/gnome/src/widget/imwidget.c b/gnome/src/widget/imwidget.c
index baf85d9eb5..84e83adbe4 100644
--- a/gnome/src/widget/imwidget.c
+++ b/gnome/src/widget/imwidget.c
@@ -31,13 +31,13 @@
 #include "logger.h"
 #include "imwidget.h"
 #include "dbus.h"
+#include "unused.h"
 #include "icons/icon_factory.h"
 #include "contacts/calltab.h"
 #include "contacts/conferencelist.h"
 #include <JavaScriptCore/JavaScript.h>
 #include <gdk/gdkkeysyms.h>
 #include <gtk/gtk.h>
-#include "sflphone_const.h"
 
 
 #define WEBKIT_DIR "file://" DATA_DIR "/webkit/"
diff --git a/gnome/src/widget/minidialog.c b/gnome/src/widget/minidialog.c
index 4bdc72214a..6889873fff 100644
--- a/gnome/src/widget/minidialog.c
+++ b/gnome/src/widget/minidialog.c
@@ -24,6 +24,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
  */
 #include <gtk/gtk.h>
+#include "unused.h"
 #include "sflphone_const.h"
 #include "minidialog.h"
 
-- 
GitLab