save as file submenu query

2012-10-14 Thread Rudra Banerjee

Dear friends,
In my project, I have created a SAVE AS file submenu.
I have two question:
1) This "save as" does not have any key board shortcut(Ctrl+S as
standard) like open or new file submenu, which are also created in the
same way, using accel group. Why this is so?
2) Though the file copying is working fine, I would love to receive some
comment about if this is a dependable(in sense of failsafe and fast)
process of copying file.
The code is as follows:


//In Main
accel_group = gtk_accel_group_new();
gtk_window_add_accel_group(GTK_WINDOW(window), accel_group);
save = gtk_image_menu_item_new_from_stock(GTK_STOCK_SAVE_AS,
accel_group);
gtk_menu_shell_append(GTK_MENU_SHELL(filemenu), save);
g_signal_connect(G_OBJECT(save), "activate",
G_CALLBACK(rename_file), NULL);



//the called function
static void rename_file(GtkWidget *widget, gpointer data)
{
   gchar *fname=NULL, *str; 
   gchar *cts;
   GError *Err=NULL;
   GtkWidget *dialog;
   gsize length;
   dialog=gtk_file_chooser_dialog_new("Save File", GTK_WINDOW(window), 
  GTK_FILE_CHOOSER_ACTION_SAVE, 
  GTK_STOCK_CANCEL,
GTK_RESPONSE_CANCEL, 
  GTK_STOCK_SAVE,
GTK_RESPONSE_ACCEPT, NULL);
  gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER
(dialog), TRUE);  
   if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT)
   {
  g_file_get_contents(filename, &cts, &length, &Err);
  filename=gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
  g_file_set_contents(filename, cts, -1, &Err);
  g_free(cts);
  if (Err)
  {
caution("Failed to save in %s",filename);
 {g_free(str); g_error_free(Err);}
  }
   }
   gtk_widget_destroy(dialog);
}



Report this post

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Cross-compilation of glib2 on win32/win64: glibconfig.h

2012-10-14 Thread Nicola Fontana
Il Sat, 13 Oct 2012 19:47:32 +0200 Nicola Fontana 
scrisse:

> Hi all,
> 
> I'm cross-compiling the GTK+ toolchain with mingw-w64 to win32
> and win64 platforms. Cairo fails in the cairo-gobject component
> in win64 mode and I strongly *suspect* this is due to a wrong
> glibconfig.h

It was my mistake: I forgot to add the proper --host triplet when
calling configure. With that option set properly, a suitable
glibconfig.h (different between win32 and win64 platforms) is
generated.

Ciao.
-- 
Nicola
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list