Commit 40571030 by karudu

Uue faili loomine

parent d0313963
Showing with 18 additions and 3 deletions
......@@ -4,7 +4,7 @@
#endif
/* TODO
Uus fail, nimeta salvestamine
Nimeta salvestamine
Scrollbar
*/
......@@ -37,6 +37,18 @@ void TekstMarkSet(GtkTextBuffer *Puhver, const GtkTextIter *new_location, GtkTex
UuendaRidaVeerg(Puhver, GTK_STATUSBAR(Data));
}
void UusFail(GtkWidget *Nupp, gpointer Data)
{
GtkTextBuffer *Puhver = GTK_TEXT_BUFFER(Data);
GtkTextIter TekstA, TekstL;
gtk_text_buffer_get_start_iter(Puhver, &TekstA);
gtk_text_buffer_get_end_iter(Puhver, &TekstL);
gtk_text_buffer_delete(Puhver, &TekstA, &TekstL);
gtk_text_buffer_set_modified(Puhver, FALSE);
}
void AvaFail(GtkWidget *Nupp, gpointer Data)
{
GtkTextBuffer *Puhver = GTK_TEXT_BUFFER(Data);
......@@ -78,11 +90,12 @@ void SalvestaFail(GtkWidget *Nupp, gpointer Data)
if(Vastus == GTK_RESPONSE_ACCEPT)
{
char *Nimi = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(Dialog));
gchar *Sisu;
GtkTextIter TekstA, TekstL;
gtk_text_buffer_get_start_iter(Puhver, &TekstA);
gtk_text_buffer_get_end_iter(Puhver, &TekstL);
Sisu = gtk_text_buffer_get_text(Puhver, &TekstA, &TekstL, TRUE);
gchar *Sisu = gtk_text_buffer_get_text(Puhver, &TekstA, &TekstL, TRUE);
gtk_text_buffer_set_modified(Puhver, FALSE);
GError *Viga = NULL;
......@@ -93,6 +106,7 @@ void SalvestaFail(GtkWidget *Nupp, gpointer Data)
}
g_free(Nimi);
g_free(Sisu);
}
gtk_widget_destroy(Dialog);
}
......@@ -140,6 +154,7 @@ int main(int argc, char **argv)
gtk_menu_item_set_submenu(GTK_MENU_ITEM(FailMenuNupp), FailMenu);
// Fail menüü
gtk_menu_shell_append(GTK_MENU_SHELL(FailMenu), FailMenuUus); // Fail->Uus
g_signal_connect(FailMenuUus, "activate", G_CALLBACK(UusFail), Puhver);
gtk_menu_shell_append(GTK_MENU_SHELL(FailMenu), FailMenuAva); // Fail->Ava
g_signal_connect(FailMenuAva, "activate", G_CALLBACK(AvaFail), Puhver);
gtk_menu_shell_append(GTK_MENU_SHELL(FailMenu), FailMenuSalvesta); // Fail->Salvesta
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment