[ekiga] Renamed the src/gui/misc.* pair to src/gui/default_devices.*, and modified the code and headers
- From: Julien Puydt <jpuydt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ekiga] Renamed the src/gui/misc.* pair to src/gui/default_devices.*, and modified the code and headers
- Date: Thu, 4 Nov 2010 17:06:52 +0000 (UTC)
commit 1ad166efe8ae9aa0cb7d8263620f469e638d0072
Author: Snark <jpuydt gnome org>
Date: Thu Nov 4 18:08:25 2010 +0100
Renamed the src/gui/misc.* pair to src/gui/default_devices.*, and modified the code and headers
The dates can now go to 2010.
As far as I know the code is now only from Eugen&myself.
I made the get_default_audio_device_name a #define.
Modified get_default_video_device_name so we only do a single loop.
src/Makefile.am | 4 +-
src/gui/assistant.cpp | 8 ++--
src/gui/{misc.cpp => default_devices.cpp} | 62 ++++++++++++++--------------
src/gui/{misc.h => default_devices.h} | 29 ++++++-------
src/gui/preferences.cpp | 14 +++---
5 files changed, 58 insertions(+), 59 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index d98b6a1..1db94f5 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -66,8 +66,8 @@ ekiga_SOURCES += \
gui/assistant.cpp \
gui/main_window.h \
gui/main_window.cpp \
- gui/misc.cpp \
- gui/misc.h \
+ gui/default_devices.cpp \
+ gui/default_devices.h \
gui/preferences.h \
gui/preferences.cpp \
gui/statusicon.h \
diff --git a/src/gui/assistant.cpp b/src/gui/assistant.cpp
index dc5673a..4a41292 100644
--- a/src/gui/assistant.cpp
+++ b/src/gui/assistant.cpp
@@ -46,7 +46,7 @@
#include "gmconf.h"
#include "toolbox/toolbox.h"
#include "assistant.h"
-#include "misc.h"
+#include "default_devices.h"
#include "opal-bank.h"
#include "videoinput-core.h"
@@ -1079,15 +1079,15 @@ prepare_audio_devices_page (EkigaAssistant *assistant)
ringer = gm_conf_get_string (SOUND_EVENTS_KEY "output_device");
if (ringer == NULL || !ringer[0])
- ringer = g_strdup (get_default_audio_device_name ());
+ ringer = g_strdup (DEFAULT_AUDIO_DEVICE_NAME);
player = gm_conf_get_string (AUDIO_DEVICES_KEY "output_device");
if (player == NULL || !player[0])
- player = g_strdup (get_default_audio_device_name ());
+ player = g_strdup (DEFAULT_AUDIO_DEVICE_NAME);
recorder = gm_conf_get_string (AUDIO_DEVICES_KEY "input_device");
if (recorder == NULL || !recorder[0])
- recorder = g_strdup (get_default_audio_device_name ());
+ recorder = g_strdup (DEFAULT_AUDIO_DEVICE_NAME);
/* FIXME: We should use DetectDevices, however DetectDevices
* works only for the currently selected audio and video plugins,
diff --git a/src/gui/misc.cpp b/src/gui/default_devices.cpp
similarity index 60%
rename from src/gui/misc.cpp
rename to src/gui/default_devices.cpp
index 418250f..9854b57 100644
--- a/src/gui/misc.cpp
+++ b/src/gui/default_devices.cpp
@@ -1,6 +1,6 @@
/* Ekiga -- A VoIP and Video-Conferencing application
- * Copyright (C) 2000-2009 Damien Sandras <dsandras seconix com>
+ * Copyright (C) 2000-2010 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
@@ -27,48 +27,48 @@
/*
- * misc.cpp - description
+ * default_devices.cpp - description
* ------------------------
* begin : Thu Nov 22 2001
- * copyright : (C) 2000-2006 by Damien Sandras
+ * copyright : (C) 2000-2010 by Damien Sandras
* description : This file contains miscellaneous functions.
- * Additional Code : De Michele Cristiano, Miguel RodrÃguez
+ * Additional Code : Eugen Dedu, Julien Puydt(Snark)
*
*/
+#include "default_devices.h"
-#include "config.h"
-
-#include "misc.h"
-
-
-/* return the default audio device name */
-const gchar *get_default_audio_device_name (void)
+/* returns the default video name from the list of existing devices */
+const gchar *
+get_default_video_device_name (const gchar * const *options)
{
-#ifdef WIN32
- return "Default (PTLIB/WindowsMultimedia)";
-#else
- return "Default (PTLIB/ALSA)";
-#endif
-}
+ int found = -1;
-/* return the default video name from the list of existing devices */
-const gchar *get_default_video_device_name (const gchar * const *options)
-{
#ifdef WIN32
/* look for the entry containing "PTLIB/DirectShow" or "PTLIB/VideoForWindows" */
- for (int i = 0; options[i]; i++)
- if (g_strrstr (options[i], "PTLIB/DirectShow")
- || g_strrstr (options[i], "PTLIB/VideoForWindows"))
- return options[i];
+ for (int ii = 0; options[ii]; ii++)
+ if (g_strrstr (options[ii], "PTLIB/DirectShow")
+ || g_strrstr (options[ii], "PTLIB/VideoForWindows")) {
+
+ found = ii;
+ break;
+ }
#else
/* look for the entry containing "PTLIB/V4L2", otherwise "PTLIB/V4L" */
- for (int i = 0; options[i]; i++)
- if (g_strrstr (options[i], "PTLIB/V4L2"))
- return options[i];
- for (int i = 0; options[i]; i++)
- if (g_strrstr (options[i], "PTLIB/V4L"))
- return options[i];
+ for (int ii = 0; options[ii]; ii++) {
+
+ if (g_strrstr (options[ii], "PTLIB/V4L2")) {
+
+ found = ii;
+ break; // we break because we prefer that
+ }
+ if (g_strrstr (options[ii], "PTLIB/V4L"))
+ found = ii; // we don't break because we still hope to find V4L2
+ }
#endif
- return NULL; // not found
+
+ if (found != -1)
+ return options[found];
+ else
+ return NULL; // not found
}
diff --git a/src/gui/misc.h b/src/gui/default_devices.h
similarity index 72%
rename from src/gui/misc.h
rename to src/gui/default_devices.h
index ceea39e..fe5edcf 100644
--- a/src/gui/misc.h
+++ b/src/gui/default_devices.h
@@ -1,6 +1,6 @@
/* Ekiga -- A VoIP and Video-Conferencing application
- * Copyright (C) 2000-2009 Damien Sandras <dsandras seconix com>
+ * Copyright (C) 2000-2010 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
@@ -27,31 +27,30 @@
/*
- * misc.h - description
+ * default_devices.h - description
* ----------------------
* begin : Thu Nov 22 2001
- * copyright : (C) 2000-2006 by Damien Sandras
+ * copyright : (C) 2000-2010 by Damien Sandras
* description : This file contains miscellaneous functions.
- * Additional Code : De Michele Cristiano, Miguel Rodríguez
+ * Additional Code : Eugen Dedu, Julien Puydt(Snark)
*
*/
-#ifndef _MISC_H_
-#define _MISC_H_
+#ifndef __DEFAULT_DEVICES_H__
+#define __DEFAULT_DEVICES_H__
#include <glib.h>
-/* DESCRIPTION : /
- * BEHAVIOR : /
- * PRE : /
- */
-const gchar *get_default_audio_device_name (void);
+/* the default audio device name */
+#ifdef WIN32
+#define DEFAULT_AUDIO_DEVICE_NAME "Default (PTLIB/WindowsMultimedia)"
+#else
+#define DEFAULT_AUDIO_DEVICE_NAME "Default (PTLIB/ALSA)"
+#endif
-/* DESCRIPTION : /
- * BEHAVIOR : /
- * PRE : /
- */
+/* returns the default video name from the list of existing devices */
const gchar *get_default_video_device_name (const gchar * const *options);
+
#endif
diff --git a/src/gui/preferences.cpp b/src/gui/preferences.cpp
index c7b27d1..3de56c2 100644
--- a/src/gui/preferences.cpp
+++ b/src/gui/preferences.cpp
@@ -40,7 +40,7 @@
#include "config.h"
#include "preferences.h"
-#include "misc.h"
+#include "default_devices.h"
#include "accounts.h"
#include "callbacks.h"
@@ -774,16 +774,16 @@ gm_pw_init_audio_devices_page (GtkWidget *prefs_window,
gm_prefs_window_get_audiooutput_devices_list (pw->core, device_list);
array = gm_prefs_window_convert_string_list(device_list);
pw->sound_events_output =
- gnome_prefs_string_option_menu_new (subsection, _("Ringing Device"), (const gchar **)array, SOUND_EVENTS_KEY "output_device", _("Select the ringing audio device to use"), 0, get_default_audio_device_name ());
+ gnome_prefs_string_option_menu_new (subsection, _("Ringing Device"), (const gchar **)array, SOUND_EVENTS_KEY "output_device", _("Select the ringing audio device to use"), 0, DEFAULT_AUDIO_DEVICE_NAME);
pw->audio_player =
- gnome_prefs_string_option_menu_new (subsection, _("Output device:"), (const gchar **)array, AUDIO_DEVICES_KEY "output_device", _("Select the audio output device to use"), 1, get_default_audio_device_name ());
+ gnome_prefs_string_option_menu_new (subsection, _("Output device:"), (const gchar **)array, AUDIO_DEVICES_KEY "output_device", _("Select the audio output device to use"), 1, DEFAULT_AUDIO_DEVICE_NAME);
g_free (array);
/* The recorder */
gm_prefs_window_get_audioinput_devices_list (pw->core, device_list);
array = gm_prefs_window_convert_string_list(device_list);
pw->audio_recorder =
- gnome_prefs_string_option_menu_new (subsection, _("Input device:"), (const gchar **)array, AUDIO_DEVICES_KEY "input_device", _("Select the audio input device to use"), 2, get_default_audio_device_name ());
+ gnome_prefs_string_option_menu_new (subsection, _("Input device:"), (const gchar **)array, AUDIO_DEVICES_KEY "input_device", _("Select the audio input device to use"), 2, DEFAULT_AUDIO_DEVICE_NAME);
g_free (array);
@@ -1288,11 +1288,11 @@ gm_prefs_window_update_devices_list (GtkWidget *prefs_window)
gnome_prefs_string_option_menu_update (pw->audio_player,
(const gchar **)array,
AUDIO_DEVICES_KEY "output_device",
- get_default_audio_device_name ());
+ DEFAULT_AUDIO_DEVICE_NAME);
gnome_prefs_string_option_menu_update (pw->sound_events_output,
(const gchar **)array,
SOUND_EVENTS_KEY "output_device",
- get_default_audio_device_name ());
+ DEFAULT_AUDIO_DEVICE_NAME);
g_free (array);
/* The recorder */
@@ -1301,7 +1301,7 @@ gm_prefs_window_update_devices_list (GtkWidget *prefs_window)
gnome_prefs_string_option_menu_update (pw->audio_recorder,
(const gchar **)array,
AUDIO_DEVICES_KEY "input_device",
- get_default_audio_device_name ());
+ DEFAULT_AUDIO_DEVICE_NAME);
g_free (array);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]