diff --git a/daemon/src/history/historyitem.cpp b/daemon/src/history/historyitem.cpp index fbc3e6e9a4b1ba03eef77d4c74e659130e45be92..33c239d0e1985044f768bf151321e22b413f6db2 100644 --- a/daemon/src/history/historyitem.cpp +++ b/daemon/src/history/historyitem.cpp @@ -51,6 +51,13 @@ const char * const HistoryItem::OUTGOING_STRING = "outgoing"; using std::map; using std::string; +namespace { + bool file_exists(const std::string &str) + { + return access(str.c_str(), F_OK) != -1; + } +} + HistoryItem::HistoryItem(const map<string, string> &args) : entryMap_(args), timestampStart_(std::atol(entryMap_[TIMESTAMP_START_KEY].c_str())) {} @@ -65,10 +72,9 @@ HistoryItem::HistoryItem(std::istream &entry) : entryMap_(), timestampStart_(0) else if (pos < tmp.length() - 1) { string key(tmp.substr(0, pos)); string val(tmp.substr(pos + 1, tmp.length() - pos - 1)); - if(key == RECORDING_PATH_KEY && !fexist(val)) - entryMap_[key] = ""; - else - entryMap_[key] = val; + if (key == RECORDING_PATH_KEY and not file_exists(val)) + val = ""; + entryMap_[key] = val; } } timestampStart_ = std::atol(entryMap_[TIMESTAMP_START_KEY].c_str()); @@ -89,18 +95,13 @@ bool HistoryItem::hasPeerNumber() const return entryMap_.find(PEER_NUMBER_KEY) != entryMap_.end(); } -bool HistoryItem::fexist(const std::string &str) const -{ - return access(str.c_str(), F_OK) != -1; -} - void HistoryItem::print(std::ostream &o) const { // every entry starts with "[" + random integer = "]" for (map<string, string>::const_iterator iter = entryMap_.begin(); iter != entryMap_.end(); ++iter) { // if the file does not exist anymore, we do not save it - if(iter->first == RECORDING_PATH_KEY && !fexist(iter->second)) + if (iter->first == RECORDING_PATH_KEY and not file_exists(iter->second)) o << iter->first << "=" << "" << std::endl; else o << iter->first << "=" << iter->second << std::endl; diff --git a/daemon/src/history/historyitem.h b/daemon/src/history/historyitem.h index e21d834b0543582cd93e23bdc7077039d010b93c..3f7e1e5143215cefc002648cfa81f13cacdc7957 100644 --- a/daemon/src/history/historyitem.h +++ b/daemon/src/history/historyitem.h @@ -59,7 +59,6 @@ class HistoryItem { bool youngerThan(unsigned long otherTime) const; std::map<std::string, std::string> toMap() const; - bool fexist(const std::string &str) const; void print(std::ostream &o) const; bool operator< (const HistoryItem &other) const { return timestampStart_ > other.timestampStart_; diff --git a/daemon/src/managerimpl.cpp b/daemon/src/managerimpl.cpp index b1c5a7744718fbfb42668578a4a0a903e7460e3d..beacfaca3b608135ed2bd6dde45287f1d750ec54 100644 --- a/daemon/src/managerimpl.cpp +++ b/daemon/src/managerimpl.cpp @@ -81,7 +81,7 @@ ManagerImpl::ManagerImpl() : toneMutex_(), telephoneTone_(), audiofile_(), audioLayerMutex_(), waitingCall_(), waitingCallMutex_(), nbIncomingWaitingCall_(0), path_(), callAccountMap_(), callAccountMapMutex_(), IPToIPMap_(), accountMap_(), - mainBuffer_(), conferenceMap_(), history_() + mainBuffer_(), conferenceMap_(), history_(), finished_(false) { // initialize random generator for call id srand(time(NULL)); @@ -126,8 +126,14 @@ void ManagerImpl::run() void ManagerImpl::finish() { - terminate(); - dbus_.exit(); + if (!finished_) { + finished_ = true; + // Unset signal handlers + signal(SIGTERM, SIG_DFL); + signal(SIGINT, SIG_DFL); + terminate(); + dbus_.exit(); + } } void ManagerImpl::terminate() diff --git a/daemon/src/managerimpl.h b/daemon/src/managerimpl.h index 39d9fa821f2b8c45e90197958b97fe01afcf692e..3bb7755d16af25516e7095b9c36386101cd133f3 100644 --- a/daemon/src/managerimpl.h +++ b/daemon/src/managerimpl.h @@ -1115,5 +1115,6 @@ class ManagerImpl { * TODO: move this to ConfigurationManager */ History history_; + bool finished_; }; #endif // MANAGER_IMPL_H_ diff --git a/gnome/src/config/accountconfigdialog.c b/gnome/src/config/accountconfigdialog.c index 1127993b622b0f879f31e67cd82cd6f4977ac335..555ea69ff9f44bbb17f4b044e04b2aec43270f06 100644 --- a/gnome/src/config/accountconfigdialog.c +++ b/gnome/src/config/accountconfigdialog.c @@ -1218,8 +1218,9 @@ static void update_account_from_basic_tab(account_t *account) const gboolean tone_enabled = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(enable_tone)); account_replace(account, CONFIG_RINGTONE_ENABLED, bool_to_string(tone_enabled)); - account_replace(account, CONFIG_RINGTONE_PATH, - gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(file_chooser))); + gchar *ringtone_path = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(file_chooser)); + account_replace(account, CONFIG_RINGTONE_PATH, ringtone_path); + g_free(ringtone_path); gchar *address_combo_text = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(local_address_combo)); account_replace(account, LOCAL_INTERFACE, address_combo_text); diff --git a/gnome/src/config/audioconf.c b/gnome/src/config/audioconf.c index c47effe19e0f3f7aae9e03c30ee6f70f0e447d63..d6caf45894038290e3a47a989a0f599200a89f9b 100644 --- a/gnome/src/config/audioconf.c +++ b/gnome/src/config/audioconf.c @@ -52,7 +52,7 @@ static GtkWidget *ringtone; static GtkWidget *plugin; static GtkWidget *codecMoveUpButton; static GtkWidget *codecMoveDownButton; -static GtkWidget *codecTreeView; // View used instead of store to get access to selection +static GtkWidget *codecTreeView; // View used instead of store to get access to selection static GtkWidget *pulse; static GtkWidget *alsabox; static GtkWidget *alsa_conf; @@ -769,11 +769,11 @@ GtkWidget* alsa_box() return alsa_hbox; } -static void record_path_changed(GtkFileChooser *chooser , GtkLabel *label UNUSED) +static void record_path_changed(GtkFileChooserButton *chooser, gpointer data UNUSED) { - gchar* path; - path = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(chooser)); + gchar* path = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(chooser)); dbus_set_record_path(path); + g_free(path); } GtkWidget* create_audio_configuration() @@ -831,7 +831,7 @@ GtkWidget* create_audio_configuration() gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(folderChooser), recordingPath); g_free(recordingPath); - g_signal_connect(G_OBJECT(folderChooser) , "selection_changed" , G_CALLBACK(record_path_changed) , NULL); + g_signal_connect(G_OBJECT(folderChooser) , "selection-changed", G_CALLBACK(record_path_changed) , NULL); gtk_table_attach(GTK_TABLE(table), folderChooser, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 5); // isAlwaysRecording functionality checkbox diff --git a/gnome/src/mainwindow.c b/gnome/src/mainwindow.c index 4efe9cc2382222c60e2e98fbc50c11efec399482..5ff00178e2c3f231a5b8f9825472cde42376d297 100644 --- a/gnome/src/mainwindow.c +++ b/gnome/src/mainwindow.c @@ -245,13 +245,14 @@ create_main_window() if(seekslider == NULL) WARN("Error could not create widget\n"); - gtk_box_pack_start(GTK_BOX(vbox), seekslider, FALSE, TRUE, 0); /* Add tree views */ gtk_box_pack_start(GTK_BOX(vbox), current_calls_tab->tree, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox), history_tab->tree, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox), contacts_tab->tree, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(vbox), seekslider, FALSE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(vbox), subvbox, FALSE, FALSE, 0); speaker_control = create_slider("speaker");