Пример #1
0
void
gnomemeeting_window_get_size (GtkWidget *w,
			      int & x,
			      int & y)
{
  gchar *window_name = NULL;
  gchar *conf_key_size = NULL;
  gchar *size = NULL;

  gchar **couple = NULL;
  
  g_return_if_fail (w != NULL);
  
  window_name = (char *) g_object_get_data (G_OBJECT (w), "window_name");

  g_return_if_fail (window_name != NULL);
  
  conf_key_size =
    g_strdup_printf ("%s%s/size", USER_INTERFACE_KEY, window_name);  

  
  size = gm_conf_get_string (conf_key_size);
  if (size)
    couple = g_strsplit (size, ",", 0);

  if (couple && couple [0])
    x = atoi (couple [0]);
  if (couple && couple [1])
    y = atoi (couple [1]);

  g_strfreev (couple);
  g_free (size);
  g_free (conf_key_size);
}
Пример #2
0
void 
gm_window_get_size (GmWindow *self,
                    int *x,
                    int *y)
{
  gchar *conf_key_size = NULL;
  gchar *size = NULL;
  gchar **couple = NULL;

  g_return_if_fail (self != NULL);

  conf_key_size = g_strdup_printf ("%s/size", self->priv->key);
  size = gm_conf_get_string (conf_key_size);
  if (size)
    couple = g_strsplit (size, ",", 0);

  if (x && couple && couple [0])
    *x = atoi (couple [0]);
  if (y && couple && couple [1])
    *y = atoi (couple [1]);

  g_free (conf_key_size);
  g_free (size);
  g_strfreev (couple);
}
Пример #3
0
void
gnome_prefs_string_option_menu_update (GtkWidget *option_menu,
				       const gchar **options,
				       const gchar *conf_key,
                                       const gchar *default_value)
{
  GtkTreeModel *model = NULL;
  GtkTreeIter iter;

  gchar *conf_string = NULL;
  
  int history = -1;
  int cpt = 0;

  if (!options || !conf_key)
    return;
  
  conf_string = gm_conf_get_string (conf_key);
  if (conf_string == NULL)
    conf_string = g_strdup (default_value);

  model = gtk_combo_box_get_model (GTK_COMBO_BOX (option_menu));

  gtk_list_store_clear (GTK_LIST_STORE (model));

  cpt = 0;
  while (options [cpt]) {

    if (conf_string && !g_strcmp0 (options [cpt], conf_string)) 
      history = cpt;

    gtk_list_store_append (GTK_LIST_STORE (model), &iter);
    gtk_list_store_set (GTK_LIST_STORE (model), &iter, 
                        COLUMN_STRING_RAW, options [cpt],
                        COLUMN_STRING_TRANSLATED, options [cpt],
                        COLUMN_SENSITIVE, TRUE, 
                        -1);
    cpt++;
  }

  if (history == -1) {
    
    if (conf_string && g_strcmp0 (conf_string, "")) {

      gtk_list_store_append (GTK_LIST_STORE (model), &iter);
      gtk_list_store_set (GTK_LIST_STORE (model), &iter,
                          COLUMN_STRING_RAW, conf_string,
                          COLUMN_STRING_TRANSLATED, gettext (conf_string),
                          COLUMN_SENSITIVE, FALSE, 
                          -1);
      history = cpt;
    }
    else
      history = --cpt;
  }

  gtk_combo_box_set_active (GTK_COMBO_BOX (option_menu), history);
  
  g_free (conf_string); 
}
Пример #4
0
/* DESCRIPTION  :  This function is called when a string option menu changes.
 * BEHAVIOR     :  Updates the key given as parameter to the new value of the
 *                 string option menu.  
 * PRE          :  Non-Null data corresponding to the string config key to
 *                 modify.
 */
void
string_option_menu_changed (GtkWidget *option_menu,
			    gpointer data)
{
  GtkTreeModel *model = NULL;
  GtkTreeIter iter;
  
  gchar *text = NULL;
  gchar *current_value = NULL;
  gchar *key = NULL;

  key = (gchar *) data;

  model = gtk_combo_box_get_model (GTK_COMBO_BOX (option_menu));
  if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (option_menu), &iter)) {

    gtk_tree_model_get (GTK_TREE_MODEL (model), &iter, 0, &text, -1);
    current_value = gm_conf_get_string (key);

    if (text && current_value && g_strcmp0 (text, current_value))
      gm_conf_set_string (key, text);

    g_free (text);
  }
}
Пример #5
0
LM::Bank::Bank (boost::shared_ptr<Ekiga::PersonalDetails> details_,
		boost::shared_ptr<Dialect> dialect_,
		boost::shared_ptr<Cluster> cluster_):
  details(details_), cluster(cluster_), dialect(dialect_), doc (NULL)
{
  gchar* c_raw = gm_conf_get_string (JABBER_KEY);

  if (c_raw != NULL) { // we already have it in store

    const std::string raw = c_raw;
    doc = xmlRecoverMemory (raw.c_str (), raw.length ());
    xmlNodePtr root = xmlDocGetRootElement (doc);
    if (root == NULL) {

      root = xmlNewDocNode (doc, NULL, BAD_CAST "list", NULL);
      xmlDocSetRootElement (doc, root);
    }

    for (xmlNodePtr child = root->children; child != NULL; child = child->next) {

      if (child->type == XML_ELEMENT_NODE && child->name != NULL && xmlStrEqual (BAD_CAST ("entry"), child->name)) {

	boost::shared_ptr<Account> account (new Account (details, dialect, cluster, child));
	add (account);
      }
    }
    g_free (c_raw);

  } else { // create a new XML document

    doc = xmlNewDoc (BAD_CAST "1.0");
    xmlNodePtr root = xmlNewDocNode (doc, NULL, BAD_CAST "list", NULL);
    xmlDocSetRootElement (doc, root);
  }
}
Пример #6
0
static gboolean
ekiga_dbus_component_get_user_location (G_GNUC_UNUSED EkigaDBusComponent *self,
                                        char **location,
                                        G_GNUC_UNUSED GError **error)
{
  PTRACE (1, "DBus\tGetLocation");

  *location = gm_conf_get_string (PERSONAL_DATA_KEY "location");

  return TRUE;
}
Пример #7
0
static gboolean
ekiga_dbus_component_get_user_comment (G_GNUC_UNUSED EkigaDBusComponent *self,
                                       char **comment,
                                       G_GNUC_UNUSED GError **error)
{
  PTRACE (1, "DBus\tGetComment");

  *comment = gm_conf_get_string (PERSONAL_DATA_KEY "comment");

  return TRUE;
}
Пример #8
0
/*
 * Public API
 */
Local::Heap::Heap (boost::shared_ptr<Ekiga::PresenceCore> _presence_core,
		   boost::shared_ptr<Local::Cluster> _local_cluster):
  presence_core(_presence_core), local_cluster(_local_cluster), doc ()
{
  xmlNodePtr root;
  gchar *c_raw = gm_conf_get_string (ROSTER_KEY);

  // Build the XML document representing the contacts list from the configuration
  if (c_raw != NULL) {

    const std::string raw = c_raw;
    doc = boost::shared_ptr<xmlDoc> (xmlRecoverMemory (raw.c_str (), raw.length ()), xmlFreeDoc);
    if ( !doc)
      doc = boost::shared_ptr<xmlDoc> (xmlNewDoc (BAD_CAST "1.0"), xmlFreeDoc);

    root = xmlDocGetRootElement (doc.get ());
    if (root == NULL) {

      root = xmlNewDocNode (doc.get (), NULL, BAD_CAST "list", NULL);
      xmlDocSetRootElement (doc.get (), root);
    }

    for (xmlNodePtr child = root->children; child != NULL; child = child->next)
      if (child->type == XML_ELEMENT_NODE
	  && child->name != NULL
	  && xmlStrEqual (BAD_CAST ("entry"), child->name))
	add (child);

    g_free (c_raw);

    // Or create a new XML document
  }
  else {

    doc = boost::shared_ptr<xmlDoc> (xmlNewDoc (BAD_CAST "1.0"), xmlFreeDoc);
    root = xmlNewDocNode (doc.get (), NULL, BAD_CAST "list", NULL);
    xmlDocSetRootElement (doc.get (), root);

    {
      // add 500, 501 and 520 at ekiga.net in this case!
      std::set<std::string> groups;

      groups.insert (_("Services"));
      add (_("Echo test"), "sip:[email protected]", groups);
      add (_("Conference room"), "sip:[email protected]", groups);
      add (_("Call back test"), "sip:[email protected]", groups);
    }
  }
}
Пример #9
0
static gboolean
ekiga_dbus_component_get_user_name (G_GNUC_UNUSED EkigaDBusComponent *self,
                                    char **name,
                                    G_GNUC_UNUSED GError **error)
{
  gchar * full_name;
  PTRACE (1, "DBus\tGetName");

  full_name = gm_conf_get_string (PERSONAL_DATA_KEY "full_name");
  if (full_name)
    *name = full_name;

  /* not freeing the full name is not a leak : dbus will do it for us ! */

  return TRUE;
}
Пример #10
0
OPENLDAP::Source::Source (Ekiga::ServiceCore &_core):
    core(_core), doc(), should_add_ekiga_net_book(false)
{
    xmlNodePtr root;
    gchar *c_raw = gm_conf_get_string (KEY);

    if (c_raw != NULL && strcmp (c_raw, "")) {

        const std::string raw = c_raw;

        doc = std::tr1::shared_ptr<xmlDoc> (xmlRecoverMemory (raw.c_str (), raw.length ()), xmlFreeDoc);
        if ( !doc)
            doc = std::tr1::shared_ptr<xmlDoc> (xmlNewDoc (BAD_CAST "1.0"), xmlFreeDoc);

        root = xmlDocGetRootElement (doc.get ());

        if (root == NULL) {

            root = xmlNewDocNode (doc.get (), NULL, BAD_CAST "list", NULL);
            xmlDocSetRootElement (doc.get (), root);
        }

        migrate_from_3_0_0 ();

        for (xmlNodePtr child = root->children ;
                child != NULL ;
                child = child->next)
            if (child->type == XML_ELEMENT_NODE
                    && child->name != NULL
                    && xmlStrEqual (BAD_CAST "server", child->name))
                add (child);

        g_free (c_raw);
    } else {

        doc = std::tr1::shared_ptr<xmlDoc> (xmlNewDoc (BAD_CAST "1.0"), xmlFreeDoc);
        root = xmlNewDocNode (doc.get (), NULL, BAD_CAST "list", NULL);
        xmlDocSetRootElement (doc.get (), root);

        should_add_ekiga_net_book = true;
    }

    if (should_add_ekiga_net_book)
        new_ekiga_net_book ();
}
Пример #11
0
static void
audioev_filename_browse_cb (GtkWidget *b,
                            gpointer data)
{

  GmPreferencesWindow *pw = NULL;

  GtkTreeModel *model = NULL;
  GtkTreeSelection *selection = NULL;
  GtkTreeIter iter;

  gchar *filename = NULL;
  gchar *conf_key = NULL;
  gchar *sound_event = NULL;

  g_return_if_fail (data != NULL);
  pw = gm_pw_get_pw (GTK_WIDGET (data));

  selection =
    gtk_tree_view_get_selection (GTK_TREE_VIEW (pw->sound_events_list));

  if (gtk_tree_selection_get_selected (selection, &model, &iter)) {

    gtk_tree_model_get (GTK_TREE_MODEL (model), &iter,
      2, &conf_key, -1);

    if (conf_key) {
      filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (b));
      if (filename) {
        sound_event = gm_conf_get_string (conf_key);

        if (!sound_event || g_strcmp0 (filename, sound_event))
          gm_conf_set_string (conf_key, (gchar *) filename);

        g_free (filename);
      }

      g_free (conf_key);
      g_free (sound_event);
    }
  }
}
Пример #12
0
/* DESCRIPTION  :  This function is called when the focus of an entry changes.
 * BEHAVIOR     :  Updates the key given as parameter to the new value of the
 *                 entry.  
 * PRE          :  Non-Null data corresponding to the string config key
 *                 to modify.
 */
gboolean
entry_focus_changed (GtkWidget  *w,
                     G_GNUC_UNUSED GdkEventFocus *ev,
                     gpointer data)
{
  gchar *key = NULL;
  gchar *current_value = NULL;
  
  key = (gchar *) data;

  current_value = gm_conf_get_string (key);

  if (!current_value 
      || g_strcmp0 (current_value, gtk_entry_get_text (GTK_ENTRY (w)))) {

    gm_conf_set_string (key, (gchar *)gtk_entry_get_text (GTK_ENTRY (w)));
  }
  g_free (current_value);

  return FALSE;
}
Пример #13
0
OPENLDAP::Source::Source (Ekiga::ServiceCore &_core): core(_core), doc(NULL)
{
  xmlNodePtr root;
  gchar *c_raw = gm_conf_get_string (KEY);

  if (c_raw != NULL && strcmp (c_raw, "")) {

    const std::string raw = c_raw;

    doc = xmlRecoverMemory (raw.c_str (), raw.length ());
    if (doc == NULL)
      doc = xmlNewDoc (BAD_CAST "1.0");

    root = xmlDocGetRootElement (doc);

    if (root == NULL) {

      root = xmlNewNode (NULL, BAD_CAST "list");
      xmlDocSetRootElement (doc, root);
    }

    for (xmlNodePtr child = root->children ;
	 child != NULL ;
	 child = child->next)
      if (child->type == XML_ELEMENT_NODE
	  && child->name != NULL
	  && xmlStrEqual (BAD_CAST "server", child->name))
	add (child);

    g_free (c_raw);
  } else {

    doc = xmlNewDoc (BAD_CAST "1.0");
    root = xmlNewNode (NULL, BAD_CAST "list");
    xmlDocSetRootElement (doc, root);

    new_ekiga_net_book ();
  }
}
Пример #14
0
static void
sound_event_clicked_cb (GtkTreeSelection *selection,
			gpointer data)
{
  GtkTreeModel *model = NULL;
  GtkTreeIter iter;

  gchar *conf_key = NULL;
  gchar *filename = NULL;
  gchar *sound_event = NULL;

  if (gtk_tree_selection_get_selected (selection, &model, &iter)) {

    gtk_tree_model_get (GTK_TREE_MODEL (model), &iter,
			2, &conf_key, -1);

    if (conf_key) {

      sound_event = gm_conf_get_string (conf_key);

      if (sound_event) {

        if (!g_path_is_absolute (sound_event))
          filename = g_build_filename (DATA_DIR, "sounds", PACKAGE_NAME,
                                       sound_event, NULL);
        else
          filename = g_strdup (sound_event);

        gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (data), filename);
        g_free (filename);
        g_free (sound_event);
      }

      g_free (conf_key);
    }
  }
}
Пример #15
0
/* The public functions */
GtkWidget *
gnome_prefs_entry_new (GtkWidget *table,
		       const gchar *label_txt,
		       const gchar *conf_key,
		       const gchar *tooltip,
		       int row,
		       gboolean box)
{
  GnomePrefsWindow *gpw = NULL;
  GValue value = { 0, {{0}, {0}}};
  int cols = 0;
  GtkWidget *entry = NULL;
  GtkWidget *label = NULL;
  GtkWidget *hbox = NULL;
  
  gchar *conf_string = NULL;
  gboolean writable = FALSE;
  
  writable = gm_conf_is_key_writable (conf_key);
  
  if (box) {
    
    hbox = gtk_hbox_new (FALSE, 0);
    g_value_init (&value, G_TYPE_INT);
    g_object_get_property (G_OBJECT (table), "n-columns", &value);
    cols = g_value_get_int (&value);
    g_value_unset (&value);
  }
  
  label = gtk_label_new_with_mnemonic (label_txt);
  if (!writable)
    gtk_widget_set_sensitive (GTK_WIDGET (label), FALSE);
  
  if (box)
    gtk_box_pack_start (GTK_BOX (hbox), label,
			FALSE, FALSE, 1 * 2);
  else
    gtk_table_attach (GTK_TABLE (table), label, 0, 1, row, row+1,
		      (GtkAttachOptions) (GTK_FILL),
		      (GtkAttachOptions) (GTK_FILL),
		      0, 0);

  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
  gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);

  entry = gtk_entry_new ();
  gtk_label_set_mnemonic_widget (GTK_LABEL(label), entry);
  if (!writable)
    gtk_widget_set_sensitive (GTK_WIDGET (entry), FALSE);
  
  if (box)
    gtk_box_pack_start (GTK_BOX (hbox), entry,
			FALSE, FALSE, 1 * 2);
  else
    gtk_table_attach (GTK_TABLE (table), entry, 1, 2, row, row+1,
		      (GtkAttachOptions) (NULL),
		      (GtkAttachOptions) (NULL),
		      0, 0);
  
  conf_string =
    gm_conf_get_string (conf_key);

  if (conf_string != NULL)
    gtk_entry_set_text (GTK_ENTRY (entry), conf_string);

  g_free (conf_string);

  g_signal_connect_after (entry, "focus-out-event",
			  G_CALLBACK (entry_focus_changed),
			  (gpointer)conf_key);

  g_signal_connect_after (entry, "activate",
			  G_CALLBACK (entry_activate_changed),
			  (gpointer)conf_key);

  gm_conf_notifier_add (conf_key, entry_changed_nt, (gpointer) entry);

  if (box)
    gtk_table_attach (GTK_TABLE (table), hbox, 0, cols, row, row+1,
		      (GtkAttachOptions) (NULL),
		      (GtkAttachOptions) (NULL),
		      0, 0);

  gpw = (GnomePrefsWindow *) g_object_get_data (G_OBJECT (table), "gpw");
  if (gpw && tooltip)
    gtk_widget_set_tooltip_text (entry, tooltip);

  gtk_widget_show_all (table);
  
  return entry;
}                                                                              
Пример #16
0
GtkWidget *
gnome_prefs_string_option_menu_new (GtkWidget *table,       
				    const gchar *label_txt, 
				    const gchar **options,
				    const gchar *conf_key,       
				    const gchar *tooltip,         
				    int row,
                                    const gchar *default_value)
{
  GnomePrefsWindow *gpw = NULL;
  
  GtkWidget *label = NULL;                                                     
  GtkWidget *option_menu = NULL;
  
  GtkListStore *list_store = NULL;
  GtkCellRenderer *renderer = NULL;
  GtkTreeIter iter;
  
  gchar *conf_string = NULL;
  gboolean writable = FALSE;

  int history = -1;
  int cpt = 0;

  writable = gm_conf_is_key_writable (conf_key);

  label = gtk_label_new (label_txt);                                           
  if (!writable)
    gtk_widget_set_sensitive (GTK_WIDGET (label), FALSE);
  
  gtk_table_attach (GTK_TABLE (table), label, 0, 1, row, row+1,                
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (GTK_FILL),
                    0, 0);
                                                                               
  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);                         
  gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);

  list_store = gtk_list_store_new (3, 
                                   G_TYPE_STRING, 
                                   G_TYPE_STRING, 
                                   G_TYPE_BOOLEAN);
  option_menu = gtk_combo_box_new_with_model (GTK_TREE_MODEL (list_store));
  if (!writable)
    gtk_widget_set_sensitive (GTK_WIDGET (option_menu), FALSE);
  renderer = gtk_cell_renderer_text_new ();
  gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (option_menu), renderer, FALSE);
  gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (option_menu), renderer,
                                  "text", COLUMN_STRING_TRANSLATED,
                                  "sensitive", COLUMN_SENSITIVE,
                                  NULL);
  g_object_set (G_OBJECT (renderer), 
                "ellipsize-set", TRUE, 
                "ellipsize", PANGO_ELLIPSIZE_END, 
                "width-chars", 45, NULL);
  gtk_label_set_mnemonic_widget (GTK_LABEL (label), option_menu);

  conf_string = gm_conf_get_string (conf_key);
  if (conf_string == NULL)
    conf_string = g_strdup (default_value);
  while (options [cpt]) {

    if (conf_string && !g_strcmp0 (conf_string, options [cpt]))
      history = cpt;

    gtk_list_store_append (GTK_LIST_STORE (list_store), &iter);
    gtk_list_store_set (GTK_LIST_STORE (list_store), &iter,
                        COLUMN_STRING_RAW, options [cpt],
                        COLUMN_STRING_TRANSLATED, gettext (options [cpt]),
                        COLUMN_SENSITIVE, TRUE,
                        -1);
    cpt++;
  }

  if (history == -1) {

    if (conf_string && g_strcmp0 (conf_string, "")) {

      gtk_list_store_append (GTK_LIST_STORE (list_store), &iter);
      gtk_list_store_set (GTK_LIST_STORE (list_store), &iter,
                          COLUMN_STRING_RAW, conf_string,
                          COLUMN_STRING_TRANSLATED, gettext (conf_string),
                          COLUMN_SENSITIVE, FALSE, 
                          -1);
      history = cpt;
    }
    else
      history = 0;
  }

  gtk_combo_box_set_active (GTK_COMBO_BOX (option_menu), history);
  gtk_table_attach (GTK_TABLE (table), option_menu, 1, 2, row, row+1,
                    (GtkAttachOptions) (GTK_FILL),                
                    (GtkAttachOptions) (GTK_FILL),                
                    0, 0);           
                                                                               
  gpw = (GnomePrefsWindow *) g_object_get_data (G_OBJECT (table), "gpw");
  if (gpw && tooltip)
    gtk_widget_set_tooltip_text (option_menu, tooltip);

  g_signal_connect (option_menu, "changed",
		    G_CALLBACK (string_option_menu_changed),
  		    (gpointer) conf_key);                                   
  gm_conf_notifier_add (conf_key, string_option_menu_changed_nt,
			(gpointer) option_menu);
  
  g_free (conf_string); 

  gtk_widget_show_all (table);
  
  return option_menu;
}
Пример #17
0
static void
status_menu_clear_status_message_dialog_run (StatusMenu *self)
{
    GtkTreeIter iter, liter;

    GSList *conf_list [3] = { NULL, NULL, NULL };
    GtkWidget *dialog = NULL;
    GtkWidget *vbox = NULL;
    GtkWidget *frame = NULL;
    GtkWidget *tree_view = NULL;

    GdkPixbuf *pixbuf = NULL;
    GtkTreeSelection *selection = NULL;
    GtkListStore *list_store = NULL;
    GtkCellRenderer *renderer = NULL;
    GtkTreeViewColumn *column = NULL;
    GtkWidget *label = NULL;

    bool found = false;
    bool close = false;
    int response = 0;
    int i = 0;
    gchar *message = NULL;
    gchar *presence = NULL;
    gchar *status = NULL;

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

    // Build the dialog
    dialog = gtk_dialog_new_with_buttons (_("Custom Message"),
                                          self->priv->parent,
                                          (GtkDialogFlags) (GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT),
                                          GTK_STOCK_DELETE,
                                          GTK_RESPONSE_APPLY,
                                          GTK_STOCK_CLOSE,
                                          GTK_RESPONSE_CLOSE,
                                          NULL);
    gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_CLOSE);
    gtk_window_set_icon_name (GTK_WINDOW (dialog), GTK_STOCK_DELETE);

    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);


    label = gtk_label_new (_("Delete custom messages:"));
    gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
    gtk_box_pack_start (GTK_BOX (vbox), label, false, false, 2);

    list_store = gtk_list_store_new (3,
                                     GDK_TYPE_PIXBUF,
                                     G_TYPE_STRING,
                                     G_TYPE_INT);
    tree_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (list_store));
    g_object_unref (list_store);
    gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (tree_view), false);

    column = gtk_tree_view_column_new ();
    renderer = gtk_cell_renderer_pixbuf_new ();
    gtk_tree_view_column_pack_start (column, renderer, FALSE);
    gtk_tree_view_column_set_attributes (column, renderer,
                                         "pixbuf", 0,
                                         NULL);

    renderer = gtk_cell_renderer_text_new ();
    gtk_tree_view_column_pack_start (column, renderer, FALSE);
    gtk_tree_view_column_set_attributes (column, renderer,
                                         "text", 1,
                                         NULL);
    gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), column);

    frame = gtk_frame_new (NULL);
    gtk_container_add (GTK_CONTAINER (frame), tree_view);
    gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 2);

    if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (self->priv->list_store), &iter)) {

        do {

            gtk_tree_model_get (GTK_TREE_MODEL (self->priv->list_store), &iter,
                                COL_MESSAGE_TYPE, &i, -1);

            if (i == TYPE_CUSTOM_ONLINE || i == TYPE_CUSTOM_AWAY || i == TYPE_CUSTOM_DND) {

                gtk_tree_model_get (GTK_TREE_MODEL (self->priv->list_store), &iter,
                                    COL_ICON, &pixbuf,
                                    COL_MESSAGE, &message,
                                    -1);
                gtk_list_store_append (GTK_LIST_STORE (list_store), &liter);
                gtk_list_store_set (GTK_LIST_STORE (list_store), &liter,
                                    COL_ICON, pixbuf,
                                    COL_MESSAGE, message,
                                    COL_MESSAGE_TYPE, i,
                                    -1);
                g_free (message);
                g_object_unref (pixbuf);
            }

        } while (gtk_tree_model_iter_next (GTK_TREE_MODEL (self->priv->list_store), &iter));
    }

    // Select the first iter
    selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view));
    if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (list_store), &iter))
        gtk_tree_selection_select_iter (selection, &iter);

    gtk_widget_show_all (dialog);
    while (!close) {
        response = gtk_dialog_run (GTK_DIALOG (dialog));

        switch (response)
        {
        case GTK_RESPONSE_APPLY:
            if (gtk_tree_selection_get_selected (selection, NULL, &iter))
                gtk_list_store_remove (GTK_LIST_STORE (list_store), &iter);
            if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (list_store), &iter))
                gtk_tree_selection_select_iter (selection, &iter);
            else
                close = true;
            break;

        case GTK_RESPONSE_CLOSE:
        default:
            close = true;
        }
    }

    if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (list_store), &iter)) {

        do {

            gtk_tree_model_get (GTK_TREE_MODEL (list_store), &iter,
                                1, &message,
                                2, &i, -1);
            if (status && message && !strcmp (status, message))
                found = true;

            conf_list[i - NUM_STATUS_TYPES - 1] = g_slist_append (conf_list[i - NUM_STATUS_TYPES - 1], g_strdup (message));
            g_free (message);
        } while (gtk_tree_model_iter_next (GTK_TREE_MODEL (list_store), &iter));
    }

    for (int j = 0 ; j < 3 ; j++) {
        gm_conf_set_string_list (status_types_keys[j], conf_list[j]);
        g_slist_foreach (conf_list[j], (GFunc) g_free, NULL);
        g_slist_free (conf_list[j]);
    }

    if (!found) {
        // Reset current config
        self->priv->personal_details->set_presence_info ("online", "");
    }

    gtk_widget_destroy (dialog);
}
Пример #18
0
void
gnomemeeting_window_show (GtkWidget *w)
{
  int x = 0;
  int y = 0;

  gchar *window_name = NULL;
  gchar *conf_key_size = NULL;
  gchar *conf_key_position = NULL;
  gchar *size = NULL;
  gchar *position = NULL;
  gchar **couple = NULL;
  
  g_return_if_fail (w != NULL);
  
  window_name = (char *) g_object_get_data (G_OBJECT (w), "window_name");

  g_return_if_fail (window_name != NULL);
  
  conf_key_position =
    g_strdup_printf ("%s%s/position", USER_INTERFACE_KEY, window_name);
  conf_key_size =
    g_strdup_printf ("%s%s/size", USER_INTERFACE_KEY, window_name);  

  if (!gnomemeeting_window_is_visible (w)) {
    
    position = gm_conf_get_string (conf_key_position);
    if (position)
      couple = g_strsplit (position, ",", 0);

    if (couple && couple [0])
      x = atoi (couple [0]);
    if (couple && couple [1])
      y = atoi (couple [1]);


    if (x != 0 && y != 0)
      gtk_window_move (GTK_WINDOW (w), x, y);

    g_strfreev (couple);
    couple = NULL;
    g_free (position);


    if (gtk_window_get_resizable (GTK_WINDOW (w))) {

      size = gm_conf_get_string (conf_key_size);
      if (size)
	couple = g_strsplit (size, ",", 0);

      if (couple && couple [0])
	x = atoi (couple [0]);
      if (couple && couple [1])
	y = atoi (couple [1]);

      if (x > 0 && y > 0)
	gtk_window_resize (GTK_WINDOW (w), x, y);

      g_strfreev (couple);
      g_free (size);
    }

    gnomemeeting_threads_dialog_show (w);
  }
  
  g_free (conf_key_position);
  g_free (conf_key_size);
}
Пример #19
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);
}
Пример #20
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);
}
Пример #21
0
static void
gm_window_show (GtkWidget *w,
                G_GNUC_UNUSED gpointer data)
{
  int x = 0;
  int y = 0;

  GmWindow *self = NULL;

  gchar *conf_key_size = NULL;
  gchar *conf_key_position = NULL;
  gchar *size = NULL;
  gchar *position = NULL;
  gchar **couple = NULL;

  g_return_if_fail (w != NULL);
  
  self = GM_WINDOW (w);

  g_return_if_fail (strcmp (self->priv->key, ""));

  conf_key_position =
    g_strdup_printf ("%s/position", self->priv->key);
  conf_key_size =
    g_strdup_printf ("%s/size", self->priv->key);

  if (gtk_window_get_resizable (GTK_WINDOW (w))) {

    size = gm_conf_get_string (conf_key_size);
    if (size)
      couple = g_strsplit (size, ",", 0);

    if (couple && couple [0])
      x = atoi (couple [0]);
    if (couple && couple [1])
      y = atoi (couple [1]);

    if (x > 0 && y > 0) {
      gtk_window_resize (GTK_WINDOW (w), x, y);
    }

    g_strfreev (couple);
    g_free (size);
  }

  position = gm_conf_get_string (conf_key_position);
  if (position)
    couple = g_strsplit (position, ",", 0);

  if (couple && couple [0])
    x = atoi (couple [0]);
  if (couple && couple [1])
    y = atoi (couple [1]);

  if (x != 0 && y != 0)
    gtk_window_move (GTK_WINDOW (w), x, y);

  g_strfreev (couple);
  couple = NULL;
  g_free (position);

  gtk_widget_realize (GTK_WIDGET (w));

  g_free (conf_key_position);
  g_free (conf_key_size);
}