Beispiel #1
0
Opal::Bank::Bank (Ekiga::ServiceCore& core):
  sip_endpoint(core.get<Opal::Sip::EndPoint> ("opal-sip-endpoint")),
  presence_core(core.get<Ekiga::PresenceCore> ("presence-core")),
  notification_core(core.get<Ekiga::NotificationCore> ("notification-core")),
  personal_details(core.get<Ekiga::PersonalDetails> ("personal-details")),
  audiooutput_core(core.get<Ekiga::AudioOutputCore> ("audiooutput-core")),
  opal_component(core.get<CallManager> ("opal-component"))
{
  boost::shared_ptr<Ekiga::PresenceCore> pcore = presence_core.lock ();
  if ( !pcore)
    return;

  GSList *accounts = gm_conf_get_string_list (PROTOCOLS_KEY "accounts_list");
  GSList *accounts_iter = accounts;

  while (accounts_iter) {

    boost::shared_ptr<Account> account
      = boost::shared_ptr<Account> (new Account (sip_endpoint,
						 pcore,
						 notification_core,
						 personal_details,
						 audiooutput_core,
						 opal_component,
						 (char *)accounts_iter->data));

    add_account (account);
    Ekiga::BankImpl<Account>::add_connection (account, account->trigger_saving.connect (boost::bind (&Opal::Bank::save, this)));
    Ekiga::BankImpl<Account>::add_connection (account, account->presence_received.connect (boost::ref (presence_received)));
    Ekiga::BankImpl<Account>::add_connection (account, account->status_received.connect (boost::ref (status_received)));
    accounts_iter = g_slist_next (accounts_iter);
  }

  g_slist_foreach (accounts, (GFunc) g_free, NULL);
  g_slist_free (accounts);

  sip_endpoint->registration_event.connect (boost::bind(&Opal::Bank::on_registration_event, this, _1, _2, _3));
  sip_endpoint->mwi_event.connect (boost::bind(&Opal::Bank::on_mwi_event, this, _1, _2));

  account_added.connect (boost::bind (&Opal::Bank::update_sip_endpoint_aor_map, this));
  account_updated.connect (boost::bind (&Opal::Bank::update_sip_endpoint_aor_map, this));
  account_removed.connect (boost::bind (&Opal::Bank::update_sip_endpoint_aor_map, this));
  update_sip_endpoint_aor_map ();
}
Beispiel #2
0
static void
status_menu_custom_messages_changed (gpointer /*id*/,
                                     GmConfEntry *entry,
                                     gpointer self)
{
    std::string key = gm_conf_entry_get_key (entry);
    GSList *current = gm_conf_entry_get_list (entry);
    GSList *custom_status_array [NUM_STATUS_TYPES];

    for (int i = 0 ; i < NUM_STATUS_TYPES ; i++) {
        if (key == status_types_keys [i])
            custom_status_array [i] = current;
        else
            custom_status_array [i] = gm_conf_get_string_list (status_types_keys [i]);
    }

    status_menu_populate (STATUS_MENU (self), custom_status_array);

    for (int i = 0 ; i < NUM_STATUS_TYPES ; i++) {
        g_slist_foreach (custom_status_array [i], (GFunc) g_free, NULL);
        g_slist_free (custom_status_array [i]);
    }
}
Beispiel #3
0
static void
roster_view_gtk_init (G_GNUC_UNUSED RosterViewGtk* self)
{
  GtkWidget *scrolled_window;
  GtkWidget *vbox = NULL;
  GtkTreeModel *filtered = NULL;
  GtkTreeSelection *selection = NULL;
  GtkTreeViewColumn *col = NULL;
  GtkCellRenderer *renderer = NULL;

  self->priv = new RosterViewGtkPrivate;

  self->priv->folded_groups = gm_conf_get_string_list (CONTACTS_KEY "roster_folded_groups");
  self->priv->show_offline_contacts = gm_conf_get_bool (CONTACTS_KEY "show_offline_contacts");
  vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
  scrolled_window = gtk_scrolled_window_new (NULL, NULL);
  gtk_container_set_border_width (GTK_CONTAINER (vbox), 0);
  gtk_container_set_border_width (GTK_CONTAINER (scrolled_window), 0);
  gtk_frame_set_shadow_type (GTK_FRAME (self), GTK_SHADOW_NONE);
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
				  GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);

  self->priv->store = gtk_tree_store_new (COLUMN_NUMBER,
                                          G_TYPE_INT,         // type
                                          G_TYPE_POINTER,     // heap
                                          G_TYPE_POINTER,     // presentity
                                          G_TYPE_STRING,      // name
                                          G_TYPE_STRING,      // status
                                          G_TYPE_STRING,      // presence
                                          G_TYPE_STRING,      // color if active
                                          G_TYPE_STRING,      // group name (invisible)
                                          G_TYPE_STRING,      // presence
					  G_TYPE_BOOLEAN,     // offline
                                          G_TYPE_INT);        // timeout source

  gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (self->priv->store),
                                        COLUMN_NAME, GTK_SORT_ASCENDING);
  filtered = gtk_tree_model_filter_new (GTK_TREE_MODEL (self->priv->store),
					NULL);
  g_object_unref (self->priv->store);
  self->priv->tree_view =
    GTK_TREE_VIEW (gtk_tree_view_new_with_model (filtered));
  g_object_unref (filtered);
  gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER (filtered),
					  tree_model_filter_hide_show_offline,
					  self, NULL);

  gtk_tree_view_set_headers_visible (self->priv->tree_view, FALSE);

  gtk_container_add (GTK_CONTAINER (self), GTK_WIDGET (vbox));
  gtk_box_pack_start (GTK_BOX (vbox),
		      GTK_WIDGET (scrolled_window), TRUE, TRUE, 0);
  gtk_container_add (GTK_CONTAINER (scrolled_window),
		     GTK_WIDGET (self->priv->tree_view));

  /* Build the GtkTreeView */
  // We hide the normal GTK+ expanders and use our own
  col = gtk_tree_view_column_new ();
  renderer = gtk_cell_renderer_pixbuf_new ();
  gtk_tree_view_column_set_spacing (col, 0);
  gtk_tree_view_column_pack_start (col, renderer, TRUE);
  g_object_set (col, "visible", FALSE, NULL);
  gtk_tree_view_append_column (self->priv->tree_view, col);
  gtk_tree_view_set_expander_column (self->priv->tree_view, col);

  col = gtk_tree_view_column_new ();
  renderer = gm_cell_renderer_expander_new ();
  gtk_tree_view_column_pack_start (col, renderer, FALSE);
  g_object_set (renderer,
                "xalign", 0.0,
                "xpad", 0,
                "ypad", 0,
                "visible", TRUE,
                "expander-style", GTK_EXPANDER_COLLAPSED,
                NULL);
  gtk_tree_view_column_set_cell_data_func (col, renderer, expand_cell_data_func, NULL, NULL);
  gtk_tree_view_append_column (self->priv->tree_view, col);

  renderer = gtk_cell_renderer_text_new ();
  gtk_tree_view_column_set_spacing (col, 0);
  gtk_tree_view_column_pack_start (col, renderer, TRUE);
  gtk_tree_view_column_add_attribute (col, renderer, "text", COLUMN_NAME);
  gtk_tree_view_column_set_alignment (col, 0.0);
  g_object_set (renderer, "xalign", 0.5, "ypad", 0, NULL);
  g_object_set (renderer, "weight", PANGO_WEIGHT_BOLD, NULL);
  gtk_tree_view_column_set_cell_data_func (col, renderer,
                                           show_cell_data_func, GINT_TO_POINTER (TYPE_HEAP), NULL);

  renderer = gtk_cell_renderer_text_new ();
  gtk_tree_view_column_pack_start (col, renderer, TRUE);
  gtk_tree_view_column_add_attribute (col, renderer,
				      "text", COLUMN_NAME);
  g_object_set (renderer, "weight", PANGO_WEIGHT_BOLD, NULL);
  gtk_tree_view_column_set_cell_data_func (col, renderer,
                                           show_cell_data_func, GINT_TO_POINTER (TYPE_GROUP), NULL);

  renderer = gtk_cell_renderer_pixbuf_new ();
  g_object_set (renderer, "yalign", 0.5, "xpad", 5, NULL);
  gtk_tree_view_column_pack_start (col, renderer, FALSE);
  gtk_tree_view_column_add_attribute (col, renderer,
				      "icon-name",
				      COLUMN_PRESENCE_ICON);
  gtk_tree_view_column_set_cell_data_func (col, renderer,
                                           show_cell_data_func, GINT_TO_POINTER (TYPE_PRESENTITY), NULL);

  renderer = gm_cell_renderer_bitext_new ();
  g_object_set (renderer, "ellipsize", PANGO_ELLIPSIZE_END, "width-chars", 30, NULL);
  gtk_tree_view_column_pack_start (col, renderer, FALSE);
  gtk_tree_view_column_add_attribute (col, renderer, "primary-text", COLUMN_NAME);
  gtk_tree_view_column_add_attribute (col, renderer, "secondary-text", COLUMN_STATUS);
  gtk_tree_view_column_add_attribute (col, renderer, "foreground", COLUMN_ACTIVE);
  gtk_tree_view_column_set_cell_data_func (col, renderer,
                                           show_cell_data_func, GINT_TO_POINTER (TYPE_PRESENTITY), NULL);

  /* Callback when the selection has been changed */
  selection = gtk_tree_view_get_selection (self->priv->tree_view);
  gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
  g_signal_connect (selection, "changed",
		    G_CALLBACK (on_selection_changed), self);
  g_signal_connect (self->priv->tree_view, "event-after",
		    G_CALLBACK (on_view_event_after), self);

  /* Notifiers */
  self->priv->notifier =
    gm_conf_notifier_add (CONTACTS_KEY "show_offline_contacts",
			  show_offline_contacts_changed_nt, self);
}
Beispiel #4
0
/* The functions */
void 
gnomemeeting_conf_upgrade ()
{
  gchar *conf_url = NULL;

  int version = 0;

  version = gm_conf_get_int (GENERAL_KEY "version");
  
  /* Install the sip:, h323: and callto: GNOME URL Handlers */
  conf_url = gm_conf_get_string ("/desktop/gnome/url-handlers/callto/command");
					       
  if (!conf_url
      || !strcmp (conf_url, "gnomemeeting -c \"%s\"")) {

    
    gm_conf_set_string ("/desktop/gnome/url-handlers/callto/command", 
			"ekiga -c \"%s\"");

    gm_conf_set_bool ("/desktop/gnome/url-handlers/callto/needs_terminal", 
		      false);
    
    gm_conf_set_bool ("/desktop/gnome/url-handlers/callto/enabled", true);
  }
  g_free (conf_url);

  conf_url = gm_conf_get_string ("/desktop/gnome/url-handlers/h323/command");
  if (!conf_url 
      || !strcmp (conf_url, "gnomemeeting -c \"%s\"")) {

    gm_conf_set_string ("/desktop/gnome/url-handlers/h323/command", 
                        "ekiga -c \"%s\"");

    gm_conf_set_bool ("/desktop/gnome/url-handlers/h323/needs_terminal", false);

    gm_conf_set_bool ("/desktop/gnome/url-handlers/h323/enabled", true);
  }
  g_free (conf_url);

  conf_url = gm_conf_get_string ("/desktop/gnome/url-handlers/sip/command");
  if (!conf_url 
      || !strcmp (conf_url, "gnomemeeting -c \"%s\"")) {

    gm_conf_set_string ("/desktop/gnome/url-handlers/sip/command", 
                        "ekiga -c \"%s\"");

    gm_conf_set_bool ("/desktop/gnome/url-handlers/sip/needs_terminal", false);

    gm_conf_set_bool ("/desktop/gnome/url-handlers/sip/enabled", true);
  }
  g_free (conf_url);

  /* New full name key */
  conf_url = gm_conf_get_string (PERSONAL_DATA_KEY "full_name");
  if (!conf_url || (conf_url && !strcmp (conf_url, ""))) {

    gchar *fullname = NULL;
    gchar *firstname = gm_conf_get_string (PERSONAL_DATA_KEY "firstname");
    gchar *lastname = gm_conf_get_string (PERSONAL_DATA_KEY "lastname");

    if (firstname && lastname && strcmp (firstname, "") && strcmp (lastname, "")) {
      fullname = g_strdup_printf ("%s %s", firstname, lastname);
      gm_conf_set_string (PERSONAL_DATA_KEY "firstname", "");
      gm_conf_set_string (PERSONAL_DATA_KEY "lastname", "");
      gm_conf_set_string (PERSONAL_DATA_KEY "full_name", fullname);
      g_free (fullname);
    }
    g_free (firstname);
    g_free (lastname);
  }
  g_free (conf_url);

  /* diamondcard is now set at sip.diamondcard.us */
  GSList *accounts = gm_conf_get_string_list ("/apps/" PACKAGE_NAME "/protocols/accounts_list");
  GSList *accounts_iter = accounts;
  while (accounts_iter) {

    PString acct = (gchar *) accounts_iter->data;
    acct.Replace ("eugw.ast.diamondcard.us", "sip.diamondcard.us", TRUE);
    g_free (accounts_iter->data);
    accounts_iter->data = g_strdup ((const char *) acct);
    accounts_iter = g_slist_next (accounts_iter);
  }
  gm_conf_set_string_list ("/apps/" PACKAGE_NAME "/protocols/accounts_list", accounts);
  g_slist_foreach (accounts, (GFunc) g_free, NULL);
  g_slist_free (accounts);

  /* Audio devices */
  gchar *plugin = NULL;
  gchar *device = NULL;
  gchar *new_device = NULL;
  plugin = gm_conf_get_string (AUDIO_DEVICES_KEY "plugin");
  if (plugin && strcmp (plugin, "")) {
    device = gm_conf_get_string (AUDIO_DEVICES_KEY "input_device");
    new_device = g_strdup_printf ("%s (PTLIB/%s)", device, plugin);
    gm_conf_set_string (AUDIO_DEVICES_KEY "plugin", "");
    gm_conf_set_string (AUDIO_DEVICES_KEY "input_device", new_device);
    g_free (device);
    g_free (new_device);

    device = gm_conf_get_string (AUDIO_DEVICES_KEY "output_device");
    new_device = g_strdup_printf ("%s (PTLIB/%s)", device, plugin);
    gm_conf_set_string (AUDIO_DEVICES_KEY "plugin", "");
    gm_conf_set_string (AUDIO_DEVICES_KEY "output_device", new_device);
    g_free (device);
    g_free (new_device);

    device = gm_conf_get_string (SOUND_EVENTS_KEY "output_device");
    new_device = g_strdup_printf ("%s (PTLIB/%s)", device, plugin);
    gm_conf_set_string (SOUND_EVENTS_KEY "plugin", "");
    gm_conf_set_string (SOUND_EVENTS_KEY "output_device", new_device);
    g_free (device);
    g_free (new_device);
  }
  g_free (plugin);

  /* Video devices */
  plugin = gm_conf_get_string (VIDEO_DEVICES_KEY "plugin");
  if (plugin && strcmp (plugin, "")) {
    device = gm_conf_get_string (VIDEO_DEVICES_KEY "input_device");
    new_device = g_strdup_printf ("%s (PTLIB/%s)", device, plugin);
    gm_conf_set_string (VIDEO_DEVICES_KEY "plugin", "");
    gm_conf_set_string (VIDEO_DEVICES_KEY "input_device", new_device);
    g_free (device);
    g_free (new_device);
  }
  g_free (plugin);
}
Beispiel #5
0
GtkWidget *
status_menu_new (Ekiga::ServiceCore & core)
{
    StatusMenu *self = NULL;

    sigc::connection conn;
    GtkCellRenderer *renderer = NULL;
    GSList *custom_status_array [NUM_STATUS_TYPES];

    self = (StatusMenu *) g_object_new (STATUS_MENU_TYPE, NULL);
    self->priv = new StatusMenuPrivate ();

    self->priv->personal_details = core.get ("personal-details");
    self->priv->parent = NULL;
    self->priv->list_store = gtk_list_store_new (NUM_COLUMNS,
                             GDK_TYPE_PIXBUF,
                             G_TYPE_STRING,
                             G_TYPE_INT,
                             G_TYPE_BOOLEAN);

    gtk_combo_box_set_model (GTK_COMBO_BOX (self),
                             GTK_TREE_MODEL (self->priv->list_store));
    g_object_unref (self->priv->list_store);

    renderer = gtk_cell_renderer_pixbuf_new ();
    gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (self), renderer, FALSE);
    gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (self), renderer,
                                    "pixbuf", COL_ICON, NULL);

    renderer = gtk_cell_renderer_text_new ();
    gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (self), renderer, FALSE);
    gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (self), renderer, "text", COL_MESSAGE, NULL);
    g_object_set (renderer, "width", 130,
                  "ellipsize-set", true,
                  "ellipsize", PANGO_ELLIPSIZE_END, NULL);

    for (int i = 0 ; i < NUM_STATUS_TYPES ; i++)
        custom_status_array [i] = gm_conf_get_string_list (status_types_keys [i]);

    status_menu_populate (self, custom_status_array);

    for (int i = 0 ; i < NUM_STATUS_TYPES ; i++) {
        g_slist_foreach (custom_status_array [i], (GFunc) g_free, 0);
        g_slist_free (custom_status_array [i]);
    }

    gtk_combo_box_set_active (GTK_COMBO_BOX (self), 0);

    gtk_combo_box_set_row_separator_func (GTK_COMBO_BOX (self),
                                          (GtkTreeViewRowSeparatorFunc) status_menu_row_is_separator,
                                          NULL, NULL);
    gtk_container_set_border_width (GTK_CONTAINER (self), 0);
    status_menu_set_option (self, self->priv->personal_details->get_presence (), self->priv->personal_details->get_status ());

    g_signal_connect (G_OBJECT (self), "changed",
                      G_CALLBACK (status_menu_option_changed), self);

    gm_conf_notifier_add (PERSONAL_DATA_KEY "online_custom_status",
                          status_menu_custom_messages_changed, self);
    gm_conf_notifier_add (PERSONAL_DATA_KEY "away_custom_status",
                          status_menu_custom_messages_changed, self);
    gm_conf_notifier_add (PERSONAL_DATA_KEY "dnd_custom_status",
                          status_menu_custom_messages_changed, self);

    conn = self->priv->personal_details->updated.connect (sigc::bind (sigc::ptr_fun (on_details_updated), self));
    self->priv->connections.push_back (conn);

    return GTK_WIDGET (self);
}
Beispiel #6
0
static void
status_menu_new_status_message_dialog_run (StatusMenu *self,
        int option)
{
    gchar *presence = NULL;
    gchar *status = NULL;

    GSList *clist = NULL;
    GtkWidget *dialog = NULL;
    GtkWidget *label = NULL;
    GtkWidget *entry = NULL;
    GtkWidget *vbox = NULL;
    GtkWidget *hbox = NULL;
    GtkWidget *image = NULL;

    GdkPixbuf* icon = NULL;

    const char *message = NULL;

    presence = gm_conf_get_string (PERSONAL_DATA_KEY "short_status");
    status = gm_conf_get_string (PERSONAL_DATA_KEY "long_status");

    dialog = gtk_dialog_new_with_buttons (_("Custom Message"),
                                          self->priv->parent,
                                          (GtkDialogFlags) (GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT),
                                          GTK_STOCK_OK,
                                          GTK_RESPONSE_ACCEPT,
                                          NULL);
    gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);

    vbox = gtk_vbox_new (false, 0);
    gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
    gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), vbox, false, false, 2);

    hbox = gtk_hbox_new (false, 2);
    icon = gtk_widget_render_icon (GTK_WIDGET (self),
                                   stock_status [option - NUM_STATUS_TYPES - 1],
                                   GTK_ICON_SIZE_MENU, NULL);
    gtk_window_set_icon (GTK_WINDOW (dialog), icon);
    image = gtk_image_new_from_pixbuf (icon);
    g_object_unref (icon);
    gtk_box_pack_start (GTK_BOX (hbox), image, false, false, 2);

    label = gtk_label_new (_("Define a custom message:"));
    gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
    gtk_box_pack_start (GTK_BOX (hbox), label, false, false, 2);
    gtk_box_pack_start (GTK_BOX (vbox), hbox, false, false, 2);

    entry = gtk_entry_new ();
    gtk_entry_set_activates_default (GTK_ENTRY (entry), true);
    gtk_box_pack_start (GTK_BOX (vbox), entry, false, false, 2);

    gtk_widget_show_all (dialog);
    switch (gtk_dialog_run (GTK_DIALOG (dialog))) {

    case GTK_RESPONSE_ACCEPT:
        message = gtk_entry_get_text (GTK_ENTRY (entry));
        clist = gm_conf_get_string_list (status_types_keys[option - NUM_STATUS_TYPES - 1]);
        if (message && strcmp (message, "")) {
            clist = g_slist_append (clist, g_strdup (message));
            gm_conf_set_string_list (status_types_keys[option - NUM_STATUS_TYPES - 1], clist);
            self->priv->personal_details->set_presence_info (status_types_names[option - NUM_STATUS_TYPES - 1], message);
        }
        else {
            status_menu_set_option (self, presence ? presence : "", status ? status : "");
        }
        g_slist_foreach (clist, (GFunc) g_free, NULL);
        g_slist_free (clist);
        break;

    default:
        status_menu_set_option (self, presence ? presence : "", status ? status : "");
        break;
    }

    gtk_widget_destroy (dialog);

    g_free (presence);
    g_free (status);
}