> How I can transfer the filename from open_file to activate_func?

When the activate_func() will be invoked? is it a callback function or
something?. I don't know why and how you implemented that, but you
already retrieved filename in open_file(), if you supposed to call
activate_func() here, you can pass the filename to activate_func(),
the activate_func() much or less will be;

static void activate_func(const char *filename)
{
   FILE *fop = fopen(filename, "a" );
   /* Verify and work with it */
}

then call activate_func(filename) in open_file()

> instead of fopen("file.bib","a"), I tried fopen(open_file( *widget,
> data,filename),"a") and also adjusted the argument of open_file.
> but its not working.

You can't fopen(open_file( *widget, data,filename),"a") because it is
a programming error, peoples in this list usually will not happy to
answer this.

Regards


On Wed, Aug 22, 2012 at 7:42 PM, Rudra Banerjee <bnrj.ru...@yahoo.com> wrote:
> Thanks! Its working excellent.
> Now, I have another small problem.
> I have opened a file from the menubar filechooser dialog as:
>
> static void open_file(GtkWidget *widget, gpointer data) {
>     GtkWidget *dialog;//, *entry;
>     dialog = gtk_file_chooser_dialog_new("Open File",
>             GTK_WINDOW(window),
>             GTK_FILE_CHOOSER_ACTION_OPEN,
>             GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
>             GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
>             NULL);
>     if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) {
>         char *filename;
>         filename =
> gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
>         read_view(filename);
>         g_print(filename);
>     }
>     gtk_widget_destroy(dialog);
> }
>
> I would like to append this file from another function:
> static void
> activate_func(GtkWidget *widget, gpointer data) {
> /* OTHER STAFF */
> FILE *fop = fopen("file.bib", "a" );
>     g_fprintf( fop, "@%s{%s,\n", strcombo, strkey );
> /*ETC*/
> }
>
> instead of fopen("file.bib","a"), I tried fopen(open_file( *widget,
> data,filename),"a") and also adjusted the argument of open_file.
> but its not working.
>
> How I can transfer the filename from open_file to activate_func?
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to