static void codec_toggled_cb (G_GNUC_UNUSED GtkCellRendererToggle *cell, gchar *path_str, gpointer data) { CodecsBox *self = NULL; GtkTreeModel *model = NULL; GtkTreePath *path = NULL; GtkTreeIter iter; std::list<std::string> list; gboolean fixed = FALSE; self = CODECS_BOX (data); model = gtk_tree_view_get_model (GTK_TREE_VIEW (self->priv->codecs_list)); path = gtk_tree_path_new_from_string (path_str); /* Update the tree model */ gtk_tree_model_get_iter (model, &iter, path); gtk_tree_model_get (model, &iter, COLUMN_CODEC_ACTIVE, &fixed, -1); gtk_list_store_set (GTK_LIST_STORE (model), &iter, COLUMN_CODEC_ACTIVE, fixed^1, -1); gtk_tree_path_free (path); /* Update the gmconf key */ list = codecs_box_to_list (self); if (self->priv->type == Ekiga::Call::Audio) self->priv->audio_settings->set_string_list ("media-list", list); else if (self->priv->type == Ekiga::Call::Video) self->priv->video_settings->set_string_list ("media-list", list); }
static void codecs_box_set_property (GObject *obj, guint prop_id, const GValue *value, GParamSpec *spec) { CodecsBox *self = CODECS_BOX (obj); std::list<std::string> list; switch (prop_id) { case TYPE: self->priv->type = (Ekiga::Call::StreamType) g_value_get_int (value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, spec); break; } if (self->priv->type == Ekiga::Call::Audio) list = self->priv->audio_settings->get_string_list ("media-list"); else if (self->priv->type == Ekiga::Call::Video) list = self->priv->video_settings->get_string_list ("media-list"); }
static void codec_moved_cb (GtkWidget *widget, gpointer data) { CodecsBox *self = NULL; GtkTreeIter iter; GtkTreeIter *iter2 = NULL; GtkTreeModel *model = NULL; GtkTreeSelection *selection = NULL; GtkTreePath *tree_path = NULL; std::list<std::string> list; gchar *path_str = NULL; self = CODECS_BOX (data); model = gtk_tree_view_get_model (GTK_TREE_VIEW (self->priv->codecs_list)); selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (self->priv->codecs_list)); if (!gtk_tree_selection_get_selected (GTK_TREE_SELECTION (selection), NULL, &iter)) return; /* Update the tree view */ iter2 = gtk_tree_iter_copy (&iter); path_str = gtk_tree_model_get_string_from_iter (GTK_TREE_MODEL (model), &iter); tree_path = gtk_tree_path_new_from_string (path_str); if (!g_strcmp0 ((gchar *) g_object_get_data (G_OBJECT (widget), "operation"), "up")) gtk_tree_path_prev (tree_path); else gtk_tree_path_next (tree_path); gtk_tree_model_get_iter (GTK_TREE_MODEL (model), &iter, tree_path); if (gtk_list_store_iter_is_valid (GTK_LIST_STORE (model), &iter) && gtk_list_store_iter_is_valid (GTK_LIST_STORE (model), iter2)) gtk_list_store_swap (GTK_LIST_STORE (model), &iter, iter2); /* Scroll to the new position */ gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (self->priv->codecs_list), tree_path, NULL, FALSE, 0, 0); gtk_tree_path_free (tree_path); gtk_tree_iter_free (iter2); g_free (path_str); /* Update the key */ list = codecs_box_to_list (self); if (self->priv->type == Ekiga::Call::Audio) self->priv->audio_settings->set_string_list ("media-list", list); else if (self->priv->type == Ekiga::Call::Video) self->priv->video_settings->set_string_list ("media-list", list); }
static void codecs_box_dispose (GObject *obj) { CodecsBox *self = NULL; self = CODECS_BOX (obj); self->priv->codecs_list = NULL; G_OBJECT_CLASS (codecs_box_parent_class)->dispose (obj); }
static void settings_changed (G_GNUC_UNUSED GSettings *settings, G_GNUC_UNUSED gchar *key, gpointer data) { std::list<std::string> list; CodecsBox *self = CODECS_BOX (data); g_return_if_fail (self); std::list<std::string> current_list = codecs_box_to_list (CODECS_BOX (self)); if (self->priv->type == Ekiga::Call::Audio) list = self->priv->audio_settings->get_string_list ("media-list"); else if (self->priv->type == Ekiga::Call::Video) list = self->priv->video_settings->get_string_list ("media-list"); Ekiga::CodecList clist (list); Ekiga::CodecList curlist (current_list); if (clist != curlist) codecs_box_set_codecs (self, list); }
static void codecs_box_dispose (GObject *obj) { CodecsBox *self = NULL; self = CODECS_BOX (obj); if (self->priv->handler > 0) { if (self->priv->type == Ekiga::Call::Audio) g_signal_handler_disconnect (self->priv->audio_settings->get_g_settings (), self->priv->handler); else if (self->priv->type == Ekiga::Call::Video) g_signal_handler_disconnect (self->priv->video_settings->get_g_settings (), self->priv->handler); } self->priv->handler = 0; self->priv->codecs_list = NULL; G_OBJECT_CLASS (codecs_box_parent_class)->dispose (obj); }
static void codecs_box_get_property (GObject *obj, guint prop_id, GValue *value, GParamSpec *spec) { CodecsBox *self = CODECS_BOX (obj); switch (prop_id) { case TYPE: g_value_set_int (value, self->priv->type); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, spec); break; } }
GtkWidget * codecs_box_new_with_type (GmApplication *app, Ekiga::Call::StreamType type) { CodecsBox *self = CODECS_BOX (g_object_new (CODECS_BOX_TYPE, NULL)); Ekiga::ServiceCore& core = gm_application_get_core (app); self->priv = new _CodecsBoxPrivate (); self->priv->app = app; self->priv->call_core = core.get<Ekiga::CallCore> ("call-core"); self->priv->type = type; self->priv->audio_settings = boost::shared_ptr<Ekiga::Settings> (new Ekiga::Settings (AUDIO_CODECS_SCHEMA)); self->priv->video_settings = boost::shared_ptr<Ekiga::Settings> (new Ekiga::Settings (VIDEO_CODECS_SCHEMA)); self->priv->codecs_list = gtk_tree_view_new (); codecs_box_build (self); codecs_box_set_codecs (self, self->priv->call_core->get_codecs ()); return GTK_WIDGET (self); }