static void ipv4_hash_table_to_texbuff(gpointer key, gpointer value, gpointer user_data) { gchar string_buff[ADDRESS_STR_MAX]; GtkTextBuffer *buffer = (GtkTextBuffer*)user_data; hashipv4_t *ipv4_hash_table_entry = (hashipv4_t *)value; int addr = *(int*)key; g_snprintf(string_buff, ADDRESS_STR_MAX, "Key:0x%x IP: %s, Name: %s\n", addr, ipv4_hash_table_entry->ip, ipv4_hash_table_entry->name); gtk_text_buffer_insert_at_cursor (buffer, string_buff, -1); }
//при нажатии на "готово" в окне выбора пола void gender_ok_signal(GtkWidget* b, gpointer data) { //получение строк из виджетов std::string sMale = gtk_entry_get_text(GTK_ENTRY(genderWindow->maleEdit)); std::string sFemale = gtk_entry_get_text(GTK_ENTRY(genderWindow->femaleEdit)); //удаление окна gtk_widget_destroy(genderWindow->window); //получение текста из шаблона genderCode std::string text = get_gender_message(sMale,sFemale,genderCode); //получение GtkTextBuffer GtkTextBuffer* buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(mainWindow->messageEdit)); //и вставка в него текста gtk_text_buffer_insert_at_cursor(buffer,text.c_str(),text.length()); }
static void ipv4_hash_table_resolved_to_texbuff(gpointer key _U_, gpointer value, gpointer user_data) { gchar string_buff[ADDRESS_STR_MAX]; GtkTextBuffer *buffer = (GtkTextBuffer*)user_data; hashipv4_t *ipv4_hash_table_entry = (hashipv4_t *)value; if((ipv4_hash_table_entry->flags & DUMMY_ADDRESS_ENTRY)== 0){ g_snprintf(string_buff, ADDRESS_STR_MAX, "%s\t%s\n", ipv4_hash_table_entry->ip, ipv4_hash_table_entry->name); gtk_text_buffer_insert_at_cursor (buffer, string_buff, -1); } }
static GtkWidget* mk_page_main (t_tea_project *p) { GtkWidget *page = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_widget_show (page); ent_project_name = tea_text_entry (GTK_WIDGET(page), _("Project name"), p->project_name); ent_dir_makefile = tea_dir_selector (page, _("Makefile directory"), p->dir_makefile); ent_dir_source = tea_dir_selector (page, _("Source directory"), p->dir_source); ent_file_executable = tea_text_entry (page, _("Target executable"), p->file_executable); gtk_text_buffer_insert_at_cursor(GTK_TEXT_BUFFER(buffer_projet), "\n\n", -1); gtk_text_buffer_insert_at_cursor(GTK_TEXT_BUFFER(buffer_projet), "\nfile_executable=", -1); gtk_text_buffer_insert_at_cursor(GTK_TEXT_BUFFER(buffer_projet), p->file_executable, -1); gtk_text_buffer_insert_at_cursor(GTK_TEXT_BUFFER(buffer_projet), "\nproject_name=", -1); gtk_text_buffer_insert_at_cursor(GTK_TEXT_BUFFER(buffer_projet), p->project_name, -1); gtk_text_buffer_insert_at_cursor(GTK_TEXT_BUFFER(buffer_projet), "\ndir_makefile=", -1); gtk_text_buffer_insert_at_cursor(GTK_TEXT_BUFFER(buffer_projet), p->dir_makefile, -1); gtk_text_buffer_insert_at_cursor(GTK_TEXT_BUFFER(buffer_projet), "\ndir_source=", -1); gtk_text_buffer_insert_at_cursor(GTK_TEXT_BUFFER(buffer_projet), p->dir_source, -1); return page; }
static void eth_hash_to_texbuff(gpointer key, gpointer value, gpointer user_data) { gchar string_buff[ADDRESS_STR_MAX]; GtkTextBuffer *buffer = (GtkTextBuffer*)user_data; guint8 *eth_addr = (guint8*)key; hashether_t* tp = (hashether_t*)value; g_snprintf(string_buff, ADDRESS_STR_MAX, "%.2X:%.2X:%.2X:%.2X:%.2X:%.2X Status: %u %s %s\n", eth_addr[0], eth_addr[1], eth_addr[2], eth_addr[3], eth_addr[4], eth_addr[5], get_hash_ether_status(tp), get_hash_ether_hexaddr(tp), get_hash_ether_resolved_name(tp)); gtk_text_buffer_insert_at_cursor (buffer, string_buff, -1); }
/* Inserts the name of the selected variable into the destination widget. The destination widget must be a GtkTextView */ static void insert_source_row_into_text_view (GtkTreeIter iter, GtkWidget *dest, GtkTreeModel *model, gpointer data ) { GtkTreePath *path; PsppireDict *dict; gint *idx; struct variable *var; GtkTreeIter dict_iter; GtkTextBuffer *buffer; g_return_if_fail (GTK_IS_TEXT_VIEW (dest)); if ( GTK_IS_TREE_MODEL_FILTER (model)) { dict = PSPPIRE_DICT (gtk_tree_model_filter_get_model (GTK_TREE_MODEL_FILTER(model))); gtk_tree_model_filter_convert_iter_to_child_iter (GTK_TREE_MODEL_FILTER (model), &dict_iter, &iter); } else { dict = PSPPIRE_DICT (model); dict_iter = iter; } path = gtk_tree_model_get_path (GTK_TREE_MODEL (dict), &dict_iter); idx = gtk_tree_path_get_indices (path); var = psppire_dict_get_variable (dict, *idx); gtk_tree_path_free (path); buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (dest)); erase_selection (buffer); gtk_text_buffer_insert_at_cursor (buffer, var_get_name (var), -1); }
static void serv_port_hash_to_texbuff(gpointer key, gpointer value, gpointer user_data) { gchar string_buff[ADDRESS_STR_MAX]; GtkTextBuffer *buffer = (GtkTextBuffer*)user_data; serv_port_t *serv_port_table = (serv_port_t *)value; int port = *(int*)key; g_snprintf(string_buff, ADDRESS_STR_MAX, "Port %u \n"" TCP %s\n"" UDP %s\n"" SCTP %s\n"" DCCP %s\n", port, serv_port_table->tcp_name, serv_port_table->udp_name, serv_port_table->sctp_name, serv_port_table->dccp_name); gtk_text_buffer_insert_at_cursor (buffer, string_buff, -1); }
static void on_lgplv3_activate (GtkMenuItem *menuitem, GladeProjectProperties *properties) { gtk_text_buffer_insert_at_cursor (properties->priv->license_textbuffer, "This file is part of Foobar.\n" "\n" "Foobar is free software: you can redistribute it and/or modify\n" "it under the terms of the GNU General Public License as published by\n" "the Free Software Foundation, either version 3 of the License, or\n" "(at your option) any later version.\n" "\n" "Foobar is distributed in the hope that it will be useful,\n" "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" "GNU General Public License for more details.\n" "\n" "You should have received a copy of the GNU General Public License\n" "along with Foobar. If not, see <http://www.gnu.org/licenses/>.", -1); }
static void wka_hash_to_texbuff(gpointer key, gpointer value, gpointer user_data) { gchar string_buff[ADDRESS_STR_MAX]; GtkTextBuffer *buffer = (GtkTextBuffer*)user_data; gchar *name = (gchar *)value; gint64 eth_as_gint64 = *(gint64*)key; g_snprintf(string_buff, ADDRESS_STR_MAX, "%.2X:%.2X:%.2X:%.2X:%.2X:%.2X %s\n", (guint8)(eth_as_gint64>>40&0xff), (guint8)(eth_as_gint64>>32&0xff), (guint8)((eth_as_gint64>>24)&0xff), (guint8)((eth_as_gint64>>16)&0xff), (guint8)((eth_as_gint64>>8)&0xff), (guint8)(eth_as_gint64&0xff), name); gtk_text_buffer_insert_at_cursor (buffer, string_buff, -1); }
static void text_insert_msg(const char *title, const char *message) { GtkTextBuffer *buffer; GtkTextIter start, end; const char *msg = message; buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text_w)); gtk_text_buffer_get_bounds(buffer, &start, &end); gtk_text_buffer_delete(buffer, &start, &end); gtk_text_view_set_left_margin(GTK_TEXT_VIEW(text_w), 15); gtk_text_buffer_get_end_iter(buffer, &end); gtk_text_buffer_insert_with_tags(buffer, &end, title, -1, tag1, NULL); gtk_text_buffer_insert_at_cursor(buffer, "\n\n", 2); gtk_text_buffer_get_end_iter(buffer, &end); gtk_text_buffer_insert_with_tags(buffer, &end, msg, -1, tag2, NULL); }
static void on_command_insert_button_clicked(G_GNUC_UNUSED GtkButton *button, gpointer gdata) { const char *prefix, *id; GString *text = g_string_new("--"); switch (GPOINTER_TO_INT(gdata)) { case 't' : prefix = "thread"; id = thread_id; break; case 'g' : prefix = "group"; id = thread_group_id(); break; default : prefix = "frame"; id = frame_id; } g_string_append_printf(text, "%s ", prefix); if (id) g_string_append_printf(text, "%s ", id); gtk_text_buffer_delete_selection(command_text, FALSE, TRUE); gtk_text_buffer_insert_at_cursor(command_text, text->str, -1); g_string_free(text, TRUE); gtk_widget_grab_focus(command_view); }
static void eth_hash_to_texbuff(gpointer key, gpointer value, gpointer user_data) { gchar string_buff[ADDRESS_STR_MAX]; GtkTextBuffer *buffer = (GtkTextBuffer*)user_data; gint64 eth_as_gint64 = *(gint64*)key; hashether_t* tp = (hashether_t*)value; g_snprintf(string_buff, ADDRESS_STR_MAX, "%.2X:%.2X:%.2X:%.2X:%.2X:%.2X Status: %u %s %s\n", (guint8)(eth_as_gint64>>40&0xff), (guint8)(eth_as_gint64>>32&0xff), (guint8)((eth_as_gint64>>24)&0xff), (guint8)((eth_as_gint64>>16)&0xff), (guint8)((eth_as_gint64>>8)&0xff), (guint8)(eth_as_gint64&0xff), tp->status, tp->hexaddr, tp->resolved_name); gtk_text_buffer_insert_at_cursor (buffer, string_buff, -1); }
static void on_lgplv2_activate (GtkMenuItem *menuitem, GladeProjectProperties *properties) { gtk_text_buffer_insert_at_cursor (properties->priv->license_textbuffer, "one line to give the library's name and an idea of what it does.\n" "Copyright (C) year name of author\n" "\n" "This library is free software; you can redistribute it and/or\n" "modify it under the terms of the GNU Lesser General Public\n" "License as published by the Free Software Foundation; either\n" "version 2.1 of the License, or (at your option) any later version.\n" "\n" "This library is distributed in the hope that it will be useful,\n" "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n" "Lesser General Public License for more details.\n" "\n" "You should have received a copy of the GNU Lesser General Public\n" "License along with this library; if not, write to the Free Software\n" "Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA", -1); }
PollQuestion* pollscaledlg_run(GtkWindow *parent, PollQuestionScale *pqs) { STACK(PollScaleDlg, psdlg); PollQuestion *q = NULL; GtkTextBuffer *buffer; pollscaledlg_init(psdlg, parent); buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(psdlg->question)); if (pqs) { q = (PollQuestion*)pqs; gtk_text_buffer_insert_at_cursor(buffer, q->question, -1); gtk_spin_button_set_value(GTK_SPIN_BUTTON(psdlg->from), (gdouble)pqs->from); gtk_spin_button_set_value(GTK_SPIN_BUTTON(psdlg->to), (gdouble)pqs->to); gtk_spin_button_set_value(GTK_SPIN_BUTTON(psdlg->by), (gdouble)pqs->by); } if (gtk_dialog_run(GTK_DIALOG(psdlg->dlg)) == GTK_RESPONSE_OK) { GtkTextIter start, end; if (!pqs) pqs = g_new0(PollQuestionScale, 1); q = (PollQuestion*)pqs; q->type = PQ_SCALE; gtk_text_buffer_get_bounds(buffer, &start, &end); g_free(q->question); q->question = gtk_text_buffer_get_text(buffer, &start, &end, FALSE); pqs->from = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(psdlg->from)); pqs->to = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(psdlg->to)); pqs->by = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(psdlg->by)); } gtk_widget_destroy(GTK_WIDGET(psdlg->dlg)); return q; }
bool Gobby::FindDialog::replace() { SessionView* view = m_folder->get_current_document(); TextSessionView* text_view = dynamic_cast<TextSessionView*>(view); g_assert(text_view != NULL); // Get selected string Glib::ustring sel_str = text_view->get_selected_text(); Glib::ustring find_str = get_find_text(); // Lowercase both if we are comparing insensitive if(!m_check_case->get_active() ) { sel_str = sel_str.casefold(); find_str = find_str.casefold(); } // Replace them if they are the same if(sel_str == find_str) { GtkTextBuffer* buffer = GTK_TEXT_BUFFER(text_view->get_text_buffer()); // Replace occurrence Glib::ustring replace_text = get_replace_text(); gtk_text_buffer_delete_selection(buffer, TRUE, TRUE); gtk_text_buffer_insert_at_cursor(buffer, replace_text.c_str(), replace_text.bytes()); // and find the next find_and_select(NULL, get_direction()); return true; } else { // Search the first occurrence return find(); } }
static void cast_nick(PidginConversation* conv, const gchar* nick) { Policy prefix_policy = purple_prefs_get_int(USERCAST_CONF_PREFIX_POLICY); Policy postfix_policy = purple_prefs_get_int(USERCAST_CONF_POSTFIX_POLICY); const gchar* user_prefix = purple_prefs_get_string(USERCAST_CONF_PREFIX); const gchar* user_postfix = purple_prefs_get_string(USERCAST_CONF_POSTFIX); gchar* user_cast = NULL; gchar* user_part = NULL; gint cursor_position = 0; gint text_length = 0; gchar* text = NULL; g_object_get(conv->entry_buffer, "cursor-position", &cursor_position, NULL); g_object_get(conv->entry_buffer, "text", &text, NULL); text_length = strlen(text); if (prefix_policy == POLICY_ALWAYS || (prefix_policy == POLICY_FIRST_WORD && cursor_position == 0) || (prefix_policy == POLICY_LAST_WORD && cursor_position == text_length)) user_part = g_strdup_printf("%s%s", user_prefix, nick); else user_part = g_strdup_printf("%s", nick); if (postfix_policy == POLICY_ALWAYS || (postfix_policy == POLICY_FIRST_WORD && cursor_position == 0) || (postfix_policy == POLICY_LAST_WORD && cursor_position == text_length)) { user_cast = g_strdup_printf("%s%s", user_part, user_postfix); g_free(user_part); } else user_cast = user_part; gtk_text_buffer_insert_at_cursor(conv->entry_buffer, user_cast, -1); g_free(user_cast); }
void load_help(char *command) { FILE *file1; GtkTextBuffer *buffer; char text[256]; char cmd[15] = "##"; // add command to the end of cmd to get the string we are looking for strcat(cmd, command); // Open the help source file if ((file1 = fopen(d1.hlpnam, "r")) == NULL) { printf("Unable to open %s\n", d1.hlpnam); return; } // get a new buffer buffer = gtk_text_buffer_new(NULL); // find the starting location of this command in the file (##command) while (strstr(text, cmd) == NULL) { if (fgets(text, 256, file1) == NULL) { printf("cannot find help file content\n"); return; } } // get the first line to output fgets(text, 256, file1); // now loop until we find a line starting with ## to print text while ((text[0] != '#') && (text[1] != '#')) { gtk_text_buffer_insert_at_cursor(buffer, text, -1); fgets(text, 256, file1); } // Set the textbox to display the new buffer gtk_text_view_set_buffer(GTK_TEXT_VIEW(textbox), buffer); //close the file fclose(file1); }
static void text_insert_help(struct menu *menu) { GtkTextBuffer *buffer; GtkTextIter start, end; const char *prompt = _(menu_get_prompt(menu)); struct gstr help = str_new(); menu_get_ext_help(menu, &help); buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text_w)); gtk_text_buffer_get_bounds(buffer, &start, &end); gtk_text_buffer_delete(buffer, &start, &end); gtk_text_view_set_left_margin(GTK_TEXT_VIEW(text_w), 15); gtk_text_buffer_get_end_iter(buffer, &end); gtk_text_buffer_insert_with_tags(buffer, &end, prompt, -1, tag1, NULL); gtk_text_buffer_insert_at_cursor(buffer, "\n\n", 2); gtk_text_buffer_get_end_iter(buffer, &end); gtk_text_buffer_insert_with_tags(buffer, &end, str_get(&help), -1, tag2, NULL); str_free(&help); }
static void on_keypad_button (PsppireKeypad *kp, const gchar *syntax, gpointer data) { GtkBuilder *xml = data; GtkWidget *rhs = get_widget_assert (xml, "compute-textview1"); GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (rhs)); erase_selection (buffer); gtk_text_buffer_insert_at_cursor (buffer, syntax, strlen (syntax)); if (0 == strcmp (syntax, "()")) { GtkTextIter iter; GtkTextMark *cursor = gtk_text_buffer_get_insert (buffer); gtk_text_buffer_get_iter_at_mark (buffer, &iter, cursor); gtk_text_iter_backward_cursor_position (&iter); gtk_text_buffer_move_mark (buffer, cursor, &iter); } }
static char* pollmultidlg_option(GtkWindow *parent, const char *current) { GtkWidget *dlg, *vbox, *label, *view; GtkTextBuffer *buffer; char *newtext = NULL; dlg = gtk_dialog_new_with_buttons(_("Multi Poll Option"), parent, GTK_DIALOG_MODAL, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); jam_win_set_size(GTK_WINDOW(dlg), 300, -1); vbox = gtk_vbox_new(FALSE, 6); label = gtk_label_new_with_mnemonic(_("O_ption:")); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); view = gtk_text_view_new(); buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(view)); gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(view), GTK_WRAP_WORD); if (current) gtk_text_buffer_insert_at_cursor(buffer, current, -1); gtk_label_set_mnemonic_widget(GTK_LABEL(label), view); gtk_box_pack_start(GTK_BOX(vbox), scroll_wrap(view), TRUE, TRUE, 0); jam_dialog_set_contents(GTK_DIALOG(dlg), vbox); if (gtk_dialog_run(GTK_DIALOG(dlg)) == GTK_RESPONSE_OK) { GtkTextIter start, end; gtk_text_buffer_get_bounds(buffer, &start, &end); newtext = gtk_text_buffer_get_text(buffer, &start, &end, FALSE); } gtk_widget_destroy(dlg); return newtext; }
static void do_lower_case (GtkTextBuffer *buffer, GtkTextIter *start, GtkTextIter *end) { GString *s = g_string_new (NULL); while (!gtk_text_iter_is_end (start) && !gtk_text_iter_equal (start, end)) { gunichar c, nc; c = gtk_text_iter_get_char (start); nc = g_unichar_tolower (c); g_string_append_unichar (s, nc); gtk_text_iter_forward_char (start); } gtk_text_buffer_delete_selection (buffer, TRUE, TRUE); gtk_text_buffer_insert_at_cursor (buffer, s->str, s->len); g_string_free (s, TRUE); }
void MergeDialog::on_mergebutton(GtkButton * button) // If a merge button is clicked, it inserts the right text, and deletes // the pair of buttons. { GtkWidget *mybutton = GTK_WIDGET(button); for (unsigned int i = 0; i < buttonpairs.size(); i++) { bool match = false; if (mybutton == buttonpairs[i].button1.button) match = true; if (mybutton == buttonpairs[i].button2.button) match = true; if (match) { ustring text; if (mybutton == buttonpairs[i].button1.button) { text = buttonpairs[i].button1.text; } if (mybutton == buttonpairs[i].button2.button) { text = buttonpairs[i].button2.text; } if (text == empty_text()) text.clear(); GtkTextIter iter, iter2; gtk_text_buffer_get_iter_at_child_anchor(textbuffer, &iter, buttonpairs[i].button1.childanchor); gtk_text_buffer_place_cursor(textbuffer, &iter); iter2 = iter; gtk_text_iter_forward_char(&iter2); gtk_text_buffer_delete(textbuffer, &iter, &iter2); gtk_text_buffer_get_iter_at_child_anchor(textbuffer, &iter, buttonpairs[i].button2.childanchor); iter2 = iter; gtk_text_iter_forward_char(&iter2); gtk_text_buffer_delete(textbuffer, &iter, &iter2); if (!text.empty()) gtk_text_buffer_insert_at_cursor(textbuffer, text.c_str(), -1); } } }
/** Set up a dialog for these messages. * Msginfo may contain repeats, and should be filled out */ static void message_create_dialog(const gchar *title, DiaMessageInfo *msginfo, gchar *buf) { GtkWidget *dialog = NULL; GtkTextBuffer *textbuffer; GtkMessageType type = GTK_MESSAGE_INFO; GList *repeats; /* quite dirty in order to not change Dia's message api */ if (title) { if (0 == strcmp (title, _("Error"))) type = GTK_MESSAGE_ERROR; else if (0 == strcmp (title, _("Warning"))) type = GTK_MESSAGE_WARNING; } if (msginfo->repeats != NULL) buf = (gchar *)msginfo->repeats->data; dialog = gtk_message_dialog_new (NULL, /* no parent window */ 0, /* GtkDialogFlags */ type, GTK_BUTTONS_CLOSE, "%s", buf); if (title) { gchar *real_title; msginfo->title = title; real_title = g_strdup_printf ("Dia: %s", title); gtk_window_set_title (GTK_WINDOW(dialog), real_title); g_free (real_title); } gtk_widget_show (dialog); g_signal_connect (G_OBJECT (dialog), "response", G_CALLBACK (gtk_widget_hide), NULL); msginfo->dialog = dialog; g_signal_connect (G_OBJECT (dialog), "destroy", G_CALLBACK (message_dialog_destroyed), msginfo); msginfo->repeat_label = gtk_label_new(_("There is one similar message.")); gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(msginfo->dialog))), msginfo->repeat_label); msginfo->show_repeats = gtk_check_button_new_with_label(_("Show repeated messages")); gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(msginfo->dialog))), msginfo->show_repeats); g_signal_connect(G_OBJECT(msginfo->show_repeats), "toggled", G_CALLBACK(gtk_message_toggle_repeats), msginfo); msginfo->repeat_view = gtk_text_view_new(); gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(msginfo->dialog))), msginfo->repeat_view); gtk_text_view_set_editable(GTK_TEXT_VIEW(msginfo->repeat_view), FALSE); textbuffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(msginfo->repeat_view)); if (msginfo->repeats != NULL) { repeats = msginfo->repeats; repeats = repeats->next; for (; repeats != NULL; repeats = repeats->next) { gtk_text_buffer_insert_at_cursor(textbuffer, (gchar*)repeats->data, -1); } } msginfo->no_show_again = gtk_check_button_new_with_label(_("Don't show this message again")); gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(msginfo->dialog))), msginfo->no_show_again); g_signal_connect(G_OBJECT(msginfo->no_show_again), "toggled", G_CALLBACK(gtk_message_toggle_show_again), msginfo); }
static void gtk_message_internal(const char* title, enum ShowAgainStyle showAgain, char const *fmt, va_list args, va_list args2) { static gchar *buf = NULL; static gint alloc = 0; gint len; DiaMessageInfo *msginfo; GtkTextBuffer *textbuffer; gboolean askForShowAgain = FALSE; if (showAgain != ALWAYS_SHOW) { /* We persistently stored that the user has chosen to not see the * dialog again (whether by checking or not unchecking the box) */ persistence_register_boolean((gchar *)title, FALSE); if (persistence_get_boolean((gchar *)title)) { /* If not showing again, just return at once */ return; } askForShowAgain = TRUE; } if (message_hash_table == NULL) { message_hash_table = g_hash_table_new(g_str_hash, g_str_equal); } len = g_printf_string_upper_bound (fmt, args); if (len >= alloc) { if (buf) g_free (buf); alloc = nearest_pow (MAX(len + 1, 1024)); buf = g_new (char, alloc); } vsprintf (buf, fmt, args2); msginfo = (DiaMessageInfo*)g_hash_table_lookup(message_hash_table, fmt); if (msginfo == NULL) { msginfo = g_new0(DiaMessageInfo, 1); g_hash_table_insert(message_hash_table, (char *)fmt, msginfo); } if (msginfo->dialog == NULL) message_create_dialog(title, msginfo, buf); if (msginfo->repeats != NULL) { if (g_list_length(msginfo->repeats) > 1) { char *newlabel; guint num = g_list_length(msginfo->repeats); /* See: https://live.gnome.org/TranslationProject/DevGuidelines/Plurals */ newlabel = g_strdup_printf(g_dngettext (GETTEXT_PACKAGE, "There is %d similar message.", /* not triggered */ "There are %d similar messages.", num), num); gtk_label_set_text(GTK_LABEL(msginfo->repeat_label), newlabel); } /* for repeated messages, show the last one */ g_object_set (msginfo->dialog, "text", buf, NULL); gtk_widget_show(msginfo->repeat_label); gtk_widget_show(msginfo->show_repeats); } /* Insert in scrollable view, but only the repeated ones */ if (msginfo->repeats != NULL) { textbuffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(msginfo->repeat_view)); gtk_text_buffer_insert_at_cursor(textbuffer, buf, -1); } msginfo->repeats = g_list_prepend(msginfo->repeats, g_strdup(buf)); if (askForShowAgain) { gtk_widget_show(msginfo->no_show_again); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(msginfo->no_show_again), showAgain == SUGGEST_NO_SHOW_AGAIN); } else { gtk_widget_hide(msginfo->no_show_again); } gtk_widget_show (msginfo->dialog); }
/****** 'display function' ***************************************************/ void display(GtkTextBuffer *buffer, GtkWidget *t_view) { GtkTextTag *tag; GtkTextIter end, start, match_end, match_start; gint i, j; gchar *key, *body, *title, *artist; const gchar *song_section[] = {"Verse:", "Verse 1", "Verse 2:", "Verse 3:","Bridge:", "Bridge 1:", "Bridge 2:", "Bridge 3:", "Intro:", "End:", "PreChorus:", "Verso:", "Chorus:", "Coro:", "Puente:", "Key Shift:", "Instrumental:", "Chorus 1:", "Chorus 2:", "Chorus 3:", "Verso 1:", "Verso 2:", "Verso 3:", "Tag:"}; //----------------------------------------------------------------------------- gtk_text_buffer_get_start_iter(buffer, &start); gtk_text_buffer_get_end_iter(buffer, &end); gtk_text_buffer_delete(buffer, &start, &end); gtk_text_view_set_editable(GTK_TEXT_VIEW(t_view), FALSE); //----------------------------------------------------------------------------- // Sets attributes for Title (line 0). title = gtk_editable_get_chars(GTK_EDITABLE(entry_title), 0, -1); gtk_text_buffer_get_iter_at_line(buffer, &start, 0); gtk_text_buffer_place_cursor(buffer, &start); gtk_text_buffer_insert_at_cursor(buffer, title, -1); g_free(title); gtk_text_buffer_get_iter_at_line(buffer, &start, 0); gtk_text_buffer_get_iter_at_line(buffer, &end, 0); gtk_text_iter_forward_to_line_end(&end); tag = gtk_text_buffer_create_tag(buffer, NULL, "weight", 1000, "font", "monospace 30", "underline", PANGO_UNDERLINE_SINGLE, NULL); gtk_text_buffer_apply_tag(buffer, tag, &start, &end); //----------------------------------------------------------------------------- // Inserts text 'by:' before artist with attributes. tag = gtk_text_buffer_create_tag(buffer, NULL, "font", "monospace 10", "weight-set", TRUE, "weight", 650, NULL); gtk_text_buffer_get_iter_at_line(buffer, &start, 0); gtk_text_iter_forward_to_line_end(&start); gtk_text_buffer_place_cursor(buffer, &start); // Have to insert '\n' to create next line gtk_text_buffer_insert_at_cursor(buffer, "\n", -1); gtk_text_buffer_get_iter_at_line(buffer, &start, 1); gtk_text_buffer_place_cursor(buffer, &start); gtk_text_buffer_insert_at_cursor(buffer, "Artist: ", -1); gtk_text_buffer_get_iter_at_line(buffer, &start, 1); gtk_text_buffer_get_iter_at_line(buffer, &end, 1); gtk_text_iter_forward_to_line_end(&end); gtk_text_buffer_apply_tag(buffer, tag, &start, &end); //----------------------------------------------------------------------------- artist = gtk_editable_get_chars(GTK_EDITABLE(entry_artist), 0, -1); gtk_text_buffer_get_iter_at_line_offset(buffer, &start, 1, 8); gtk_text_buffer_place_cursor(buffer, &start); gtk_text_buffer_insert_at_cursor(buffer, artist, -1); g_free(artist); // Sets attributes for Artist (line 1). gtk_text_buffer_get_iter_at_line_offset(buffer, &start, 1, 8); gtk_text_buffer_get_iter_at_line(buffer, &end, 1); gtk_text_iter_forward_to_line_end(&end); tag = gtk_text_buffer_create_tag(buffer, NULL, "weight", 500, "weight-set", TRUE, "font", "monospace italic 12", NULL); gtk_text_buffer_apply_tag(buffer, tag, &start, &end); //----------------------------------------------------------------------------- tag = gtk_text_buffer_create_tag(buffer, NULL, "font", "monospace 10", "weight", 650, NULL); gtk_text_buffer_get_iter_at_line(buffer, &start, 1); gtk_text_iter_forward_to_line_end(&start); gtk_text_buffer_place_cursor(buffer, &start); // Have to insert '\n' to create next line gtk_text_buffer_insert_at_cursor(buffer, "\n", -1); gtk_text_buffer_get_iter_at_line(buffer, &start, 2); gtk_text_buffer_place_cursor(buffer, &start); gtk_text_buffer_insert_at_cursor(buffer, "Key: ", -1); gtk_text_buffer_get_iter_at_line(buffer, &start, 2); gtk_text_buffer_get_iter_at_line(buffer, &end, 2); gtk_text_iter_forward_to_line_end(&end); gtk_text_buffer_apply_tag(buffer, tag, &start, &end); //----------------------------------------------------------------------------- key = gtk_editable_get_chars(GTK_EDITABLE(entry_key), 0, -1); gtk_text_buffer_get_iter_at_line_offset(buffer, &start, 2, 5); gtk_text_buffer_place_cursor(buffer, &start); gtk_text_buffer_insert_at_cursor(buffer, key, -1); g_free(key); gtk_text_buffer_get_iter_at_line_offset(buffer, &start, 2, 5); gtk_text_buffer_get_iter_at_line(buffer, &end, 2); gtk_text_iter_forward_to_line_end(&end); tag = gtk_text_buffer_create_tag(buffer, NULL, "weight", 500, "weight-set", TRUE, "font", "monospace italic 12", NULL); gtk_text_buffer_apply_tag(buffer, tag, &start, &end); //----------------------------------------------------------------------------- gtk_text_buffer_get_iter_at_line(buffer, &start, 2); gtk_text_iter_forward_to_line_end(&start); gtk_text_buffer_place_cursor(buffer, &start); // Have to insert '\n' to create next line gtk_text_buffer_insert_at_cursor(buffer, "\n\n", -1); gtk_text_buffer_get_start_iter(t_buffer_editor, &start); gtk_text_buffer_get_end_iter(t_buffer_editor, &end); body = gtk_text_buffer_get_text(t_buffer_editor, &start, &end, FALSE); gtk_text_buffer_get_iter_at_line(buffer, &start, 4); gtk_text_buffer_place_cursor(buffer, &start); gtk_text_buffer_insert_at_cursor(buffer, body, -1); //----------------------------------------------------------------------------- gtk_text_buffer_get_iter_at_line(buffer, &start, 4); gtk_text_buffer_get_end_iter(buffer, &end); tag = gtk_text_buffer_create_tag(buffer, NULL, "font", "monospace", NULL); gtk_text_buffer_apply_tag(buffer, tag, &start, &end); line_count_C = gtk_text_buffer_get_line_count(buffer); gtk_text_buffer_get_start_iter(buffer, &start); if(gtk_text_iter_forward_search(&start, "[", 1, &match_start, &match_end, NULL)) { line_num_C = gtk_text_iter_get_line(&match_start); } for(i = 0; i == 0;) { i = set_chord_position(t_view, buffer); } //----------------------------------------------------------------------------- // This section is for setting the attributes of the text // 'Verse:', 'Chorus:'etc... char_line = 0; char_line_offset = 0; for(i = 0; i < 24;) { for(j = 0; j == 0;) { j = text_tags(buffer, song_section[i]); } if(j != 0) { char_line = 0; char_line_offset = 0; i++; } } //----------------------------------------------------------------------------- //g_print("Function return: %d\n", set_chord_position(t_view, buffer)); //g_print("Line number of chord: %d\n", line_num_C);*/ }
void selection_received (GtkWidget *widget, GtkSelectionData *selection_data) { int position; int i; SelType seltype; char *str; guchar *data; GtkTextBuffer *buffer; GdkAtom type; if (gtk_selection_data_get_length (selection_data) < 0) { g_print("Error retrieving selection\n"); return; } type = gtk_selection_data_get_data_type (selection_data); seltype = SEL_TYPE_NONE; for (i=0; i<LAST_SEL_TYPE; i++) { if (seltypes[i] == type) { seltype = i; break; } } if (seltype == SEL_TYPE_NONE) { char *name = gdk_atom_name (type); g_print("Don't know how to handle type: %s\n", name?name:"<unknown>"); return; } if (selection_string != NULL) g_string_free (selection_string, TRUE); selection_string = g_string_new (NULL); buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (selection_text)); gtk_text_buffer_set_text (buffer, "", -1); position = 0; while (position < gtk_selection_data_get_length (selection_data)) { data = (guchar *) gtk_selection_data_get_data (selection_data); switch (seltype) { case ATOM: str = stringify_atom (data, &position); break; case COMPOUND_TEXT: case STRING: case TEXT: str = stringify_text (data, &position); break; case BITMAP: case DRAWABLE: case PIXMAP: case WINDOW: case COLORMAP: str = stringify_xid (data, &position); break; case INTEGER: case PIXEL: str = stringify_integer (data, &position); break; case SPAN: str = stringify_span (data, &position); break; default: { char *name = gdk_atom_name (gtk_selection_data_get_data_type (selection_data)); g_print("Can't convert type %s to string\n", name?name:"<unknown>"); position = gtk_selection_data_get_length (selection_data); continue; } } gtk_text_buffer_insert_at_cursor (buffer, str, -1); gtk_text_buffer_insert_at_cursor (buffer, "\n", -1); g_string_append (selection_string, str); g_free (str); } }
static void addres_resolution_to_texbuff(GtkTextBuffer *buffer) { gchar string_buff[ADDRESS_STR_MAX]; GHashTable *manuf_hashtable; GHashTable *wka_hashtable; GHashTable *eth_hashtable; GHashTable *serv_port_hashtable; GHashTable *ipv4_hash_table; GHashTable *ipv6_hash_table; g_snprintf(string_buff, ADDRESS_STR_MAX, "# Hosts information in Wireshark \n#\n"); gtk_text_buffer_insert_at_cursor (buffer, string_buff, -1); g_snprintf(string_buff, ADDRESS_STR_MAX, "# Host data gathered from %s\n\n", cfile.filename); gtk_text_buffer_insert_at_cursor (buffer, string_buff, -1); /* Dump the v4 addresses first, then v6 */ ipv4_hash_table = get_ipv4_hash_table(); if(ipv4_hash_table){ g_hash_table_foreach( ipv4_hash_table, ipv4_hash_table_resolved_to_texbuff, buffer); } ipv6_hash_table = get_ipv6_hash_table(); if(ipv6_hash_table){ g_hash_table_foreach( ipv6_hash_table, ipv6_hash_table_resolved_to_texbuff, buffer); } g_snprintf(string_buff, ADDRESS_STR_MAX, "\n\n# Address resolution IPv4 Hash table \n#\n"); gtk_text_buffer_insert_at_cursor (buffer, string_buff, -1); if(ipv4_hash_table){ g_snprintf(string_buff, ADDRESS_STR_MAX, "# With %i entries\n#\n", g_hash_table_size(ipv4_hash_table)); gtk_text_buffer_insert_at_cursor (buffer, string_buff, -1); g_hash_table_foreach( ipv4_hash_table, ipv4_hash_table_to_texbuff, buffer); } g_snprintf(string_buff, ADDRESS_STR_MAX, "\n\n# Address resolution IPv6 Hash table \n#\n"); gtk_text_buffer_insert_at_cursor (buffer, string_buff, -1); if(ipv6_hash_table){ g_snprintf(string_buff, ADDRESS_STR_MAX, "# With %i entries\n#\n", g_hash_table_size(ipv6_hash_table)); gtk_text_buffer_insert_at_cursor (buffer, string_buff, -1); g_hash_table_foreach( ipv6_hash_table, ipv6_hash_table_to_texbuff, buffer); } g_snprintf(string_buff, ADDRESS_STR_MAX, "\n\n# Port names information in Wireshark \n#\n"); gtk_text_buffer_insert_at_cursor (buffer, string_buff, -1); serv_port_hashtable = get_serv_port_hashtable(); if(serv_port_hashtable){ g_snprintf(string_buff, ADDRESS_STR_MAX, "# With %i entries\n#\n", g_hash_table_size(serv_port_hashtable)); gtk_text_buffer_insert_at_cursor (buffer, string_buff, -1); g_hash_table_foreach( serv_port_hashtable, serv_port_hash_to_texbuff, buffer); } g_snprintf(string_buff, ADDRESS_STR_MAX, "\n\n# Eth names information in Wireshark \n#\n"); gtk_text_buffer_insert_at_cursor (buffer, string_buff, -1); eth_hashtable = get_eth_hashtable(); if(eth_hashtable){ g_snprintf(string_buff, ADDRESS_STR_MAX, "# With %i entries\n#\n", g_hash_table_size(eth_hashtable)); gtk_text_buffer_insert_at_cursor (buffer, string_buff, -1); g_hash_table_foreach( eth_hashtable, eth_hash_to_texbuff, buffer); } g_snprintf(string_buff, ADDRESS_STR_MAX, "\n\n# Manuf information in Wireshark \n#\n"); gtk_text_buffer_insert_at_cursor (buffer, string_buff, -1); manuf_hashtable = get_manuf_hashtable(); if(manuf_hashtable){ g_snprintf(string_buff, ADDRESS_STR_MAX, "# With %i entries\n#\n", g_hash_table_size(manuf_hashtable)); gtk_text_buffer_insert_at_cursor (buffer, string_buff, -1); g_hash_table_foreach( manuf_hashtable, manuf_hash_to_texbuff, buffer); } g_snprintf(string_buff, ADDRESS_STR_MAX, "\n\n# wka information in Wireshark \n#\n"); gtk_text_buffer_insert_at_cursor (buffer, string_buff, -1); wka_hashtable = get_wka_hashtable(); if(wka_hashtable){ g_snprintf(string_buff, ADDRESS_STR_MAX, "# With %i entries\n#\n", g_hash_table_size(wka_hashtable)); gtk_text_buffer_insert_at_cursor (buffer, string_buff, -1); g_hash_table_foreach( wka_hashtable, wka_hash_to_texbuff, buffer); } }
static gint document_replace_real(GtkWidget *textview) { GtkTextIter iter, match_start, match_end, rep_start; GtkTextMark *mark_init = NULL; gboolean res; gint num = 0, offset; GtkWidget *q_dialog = NULL; GtkSourceSearchFlags search_flags = GTK_SOURCE_SEARCH_VISIBLE_ONLY | GTK_SOURCE_SEARCH_TEXT_ONLY; GtkTextBuffer *textbuffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview)); if (!match_case) search_flags = search_flags | GTK_SOURCE_SEARCH_CASE_INSENSITIVE; if (replace_all) { gtk_text_buffer_get_iter_at_mark(textbuffer, &iter, gtk_text_buffer_get_insert(textbuffer)); mark_init = gtk_text_buffer_create_mark(textbuffer, NULL, &iter, FALSE); gtk_text_buffer_get_start_iter(textbuffer, &iter); gtk_text_buffer_get_end_iter(textbuffer, &match_end); // gtk_text_buffer_remove_tag_by_name(textbuffer, // "replaced", &iter, &match_end); gtk_text_buffer_remove_all_tags(textbuffer, &iter, &match_end); } else { hlight_searched_strings(textbuffer, string_find); hlight_toggle_searched(textbuffer); } do { if (replace_all) { res = gtk_source_iter_forward_search( &iter, string_find, search_flags, &match_start, &match_end, NULL); if (res) { gtk_text_buffer_place_cursor(textbuffer, &match_start); gtk_text_buffer_move_mark_by_name(textbuffer, "insert", &match_end); gtk_text_buffer_get_iter_at_mark( textbuffer, &iter, gtk_text_buffer_get_insert(textbuffer)); } } else // res = document_search_real(textview, 0); res = document_search_real(textview, 2); if (res) { if (!replace_all) { if (num == 0 && q_dialog == NULL) q_dialog = create_dialog_message_question( gtk_widget_get_toplevel(textview), _("Replace?")); #if GTK_CHECK_VERSION(2, 10, 0) GtkTextIter ins,bou; gtk_text_buffer_get_selection_bounds(textbuffer, &ins, &bou); #endif switch (gtk_dialog_run(GTK_DIALOG(q_dialog))) { case GTK_RESPONSE_YES: #if GTK_CHECK_VERSION(2, 10, 0) gtk_text_buffer_select_range(textbuffer, &ins, &bou); #endif break; case GTK_RESPONSE_NO: continue; // case GTK_RESPONSE_CANCEL: default: res = 0; if (num == 0) num = -1; continue; } } gtk_text_buffer_delete_selection(textbuffer, TRUE, TRUE); if (strlen(string_replace)) { gtk_text_buffer_get_iter_at_mark( textbuffer, &rep_start, gtk_text_buffer_get_insert(textbuffer)); offset = gtk_text_iter_get_offset(&rep_start); undo_set_sequency(TRUE); g_signal_emit_by_name(G_OBJECT(textbuffer), "begin-user-action"); gtk_text_buffer_insert_at_cursor(textbuffer, string_replace, strlen(string_replace)); g_signal_emit_by_name(G_OBJECT(textbuffer), "end-user-action"); gtk_text_buffer_get_iter_at_mark( textbuffer, &iter, gtk_text_buffer_get_insert(textbuffer)); gtk_text_buffer_get_iter_at_offset(textbuffer, &rep_start, offset); gtk_text_buffer_apply_tag_by_name(textbuffer, "replaced", &rep_start, &iter); } else gtk_text_buffer_get_iter_at_mark( textbuffer, &iter, gtk_text_buffer_get_insert(textbuffer)); num++; /* if (replace_all) undo_set_sequency(TRUE); else undo_set_sequency(FALSE);*/ undo_set_sequency(replace_all); } } while (res); if (!hlight_check_searched()) hlight_toggle_searched(textbuffer); if (q_dialog) gtk_widget_destroy(q_dialog); /* if (strlen(string_replace)) { replace_mode = TRUE; hlight_searched_strings(textbuffer, string_replace); } */ if (replace_all) { gtk_text_buffer_get_iter_at_mark(textbuffer, &iter, mark_init); gtk_text_buffer_place_cursor(textbuffer, &iter); run_dialog_message(gtk_widget_get_toplevel(textview), GTK_MESSAGE_INFO, _("%d strings replaced"), num); undo_set_sequency(FALSE); } return num; }
/* Extract metadata from all the streams and write it to the text widget in the GUI */ static void analyze_streams (CustomData *data) { gint i; GstTagList *tags; gchar *str, *total_str; guint rate; gint n_video, n_audio, n_text; GtkTextBuffer *text; /* Clean current contents of the widget */ text = gtk_text_view_get_buffer (GTK_TEXT_VIEW (data->streams_list)); gtk_text_buffer_set_text (text, "", -1); /* Read some properties */ g_object_get (data->playbin, "n-video", &n_video, NULL); g_object_get (data->playbin, "n-audio", &n_audio, NULL); g_object_get (data->playbin, "n-text", &n_text, NULL); for (i = 0; i < n_video; i++) { tags = NULL; /* Retrieve the stream's video tags */ g_signal_emit_by_name (data->playbin, "get-video-tags", i, &tags); if (tags) { total_str = g_strdup_printf ("video stream %d:\n", i); gtk_text_buffer_insert_at_cursor (text, total_str, -1); g_free (total_str); gst_tag_list_get_string (tags, GST_TAG_VIDEO_CODEC, &str); total_str = g_strdup_printf (" codec: %s\n", str ? str : "unknown"); gtk_text_buffer_insert_at_cursor (text, total_str, -1); g_free (total_str); g_free (str); gst_tag_list_free (tags); } } for (i = 0; i < n_audio; i++) { tags = NULL; /* Retrieve the stream's audio tags */ g_signal_emit_by_name (data->playbin, "get-audio-tags", i, &tags); if (tags) { total_str = g_strdup_printf ("\naudio stream %d:\n", i); gtk_text_buffer_insert_at_cursor (text, total_str, -1); g_free (total_str); if (gst_tag_list_get_string (tags, GST_TAG_AUDIO_CODEC, &str)) { total_str = g_strdup_printf (" codec: %s\n", str); gtk_text_buffer_insert_at_cursor (text, total_str, -1); g_free (total_str); g_free (str); } if (gst_tag_list_get_string (tags, GST_TAG_LANGUAGE_CODE, &str)) { total_str = g_strdup_printf (" language: %s\n", str); gtk_text_buffer_insert_at_cursor (text, total_str, -1); g_free (total_str); g_free (str); } if (gst_tag_list_get_uint (tags, GST_TAG_BITRATE, &rate)) { total_str = g_strdup_printf (" bitrate: %d\n", rate); gtk_text_buffer_insert_at_cursor (text, total_str, -1); g_free (total_str); } gst_tag_list_free (tags); } } for (i = 0; i < n_text; i++) { tags = NULL; /* Retrieve the stream's subtitle tags */ g_signal_emit_by_name (data->playbin, "get-text-tags", i, &tags); if (tags) { total_str = g_strdup_printf ("\nsubtitle stream %d:\n", i); gtk_text_buffer_insert_at_cursor (text, total_str, -1); g_free (total_str); if (gst_tag_list_get_string (tags, GST_TAG_LANGUAGE_CODE, &str)) { total_str = g_strdup_printf (" language: %s\n", str); gtk_text_buffer_insert_at_cursor (text, total_str, -1); g_free (total_str); g_free (str); } gst_tag_list_free (tags); } } }
void tea_proj_save_as (t_tea_project *p, gchar *name) { if (! p) return; if (! name) return; p->project_file_name = ch_str (p->project_file_name, name); GList *l = NULL; gtk_text_buffer_insert_at_cursor(GTK_TEXT_BUFFER(buffer_projet), "\nProeject file name :\n", -1); gtk_text_buffer_insert_at_cursor(GTK_TEXT_BUFFER(buffer_projet), p->project_file_name, -1); gtk_text_buffer_insert_at_cursor(GTK_TEXT_BUFFER(buffer_projet), "\n\n", -1); gtk_text_buffer_insert_at_cursor(GTK_TEXT_BUFFER(buffer_projet), "\nfile_executable=", -1); gtk_text_buffer_insert_at_cursor(GTK_TEXT_BUFFER(buffer_projet), p->file_executable, -1); gtk_text_buffer_insert_at_cursor(GTK_TEXT_BUFFER(buffer_projet), "\nproject_name=", -1); gtk_text_buffer_insert_at_cursor(GTK_TEXT_BUFFER(buffer_projet), p->project_name, -1); gtk_text_buffer_insert_at_cursor(GTK_TEXT_BUFFER(buffer_projet), "\ndir_makefile=", -1); gtk_text_buffer_insert_at_cursor(GTK_TEXT_BUFFER(buffer_projet), p->dir_makefile, -1); gtk_text_buffer_insert_at_cursor(GTK_TEXT_BUFFER(buffer_projet), "\ndir_source=", -1); gtk_text_buffer_insert_at_cursor(GTK_TEXT_BUFFER(buffer_projet), p->dir_source, -1); l = add_to_glist_combined_str (l, "file_executable", p->file_executable); l = add_to_glist_combined_str (l, "project_name", p->project_name); l = add_to_glist_combined_str (l, "project_file_name", p->project_file_name); l = add_to_glist_combined_str (l, "dir_makefile", p->dir_makefile); l = add_to_glist_combined_str (l, "dir_source", p->dir_source); glist_save_to_file (l, p->project_file_name); g_list_free (l); }