From: <mar...@us...> - 2009-07-22 15:02:50
|
Revision: 12249 http://gphoto.svn.sourceforge.net/gphoto/?rev=12249&view=rev Author: marcusmeissner Date: 2009-07-22 15:02:46 +0000 (Wed, 22 Jul 2009) Log Message: ----------- disabled/deleted file renaming put_file adaption for libgphoto2 2.5 usage Modified Paths: -------------- trunk/gtkam/src/gtkam-info.c trunk/gtkam/src/gtkam-list.c trunk/gtkam/src/gtkam-save.c trunk/gtkam/src/gtkam-tree.c Modified: trunk/gtkam/src/gtkam-info.c =================================================================== --- trunk/gtkam/src/gtkam-info.c 2009-07-22 07:46:01 UTC (rev 12248) +++ trunk/gtkam/src/gtkam-info.c 2009-07-22 15:02:46 UTC (rev 12249) @@ -217,18 +217,9 @@ static void on_ok_clicked (GtkButton *button, GtkamInfo *info) { - gchar *n; - - n = g_strdup (info->priv->info.file.name); - if (info->priv->needs_update) { - if (gtkam_info_update (info)) - gtk_object_destroy (GTK_OBJECT (info)); - else { - gtk_entry_set_text (GTK_ENTRY (info->priv->entry_name), n); - } - } else - gtk_object_destroy (GTK_OBJECT (info)); - g_free (n); + if (info->priv->needs_update) + gtkam_info_update (info); + gtk_object_destroy (GTK_OBJECT (info)); } static void @@ -261,28 +252,12 @@ info->priv->needs_update = TRUE; } -static void -on_name_changed (GtkEditable *editable, GtkamInfo *info) -{ - const gchar *name; - - info->priv->info_new.file.fields |= GP_FILE_INFO_NAME; - name = gtk_entry_get_text (GTK_ENTRY (editable)); - strncpy (info->priv->info_new.file.name, name, - sizeof (info->priv->info_new.file.name) - 1); - info->priv->needs_update = TRUE; - - if (info->priv->new_name) - g_free (info->priv->new_name); - info->priv->new_name = g_strdup (name); -} - GtkWidget * gtkam_info_new (GtkamCamera *camera, const gchar *folder, const gchar *name) { GtkamInfo *info; GtkWidget *button, *dialog, *notebook, *page, *label, *hbox; - GtkWidget *check, *entry, *c; + GtkWidget *check, *c; gchar *msg; int result; CameraFileInfo i; @@ -336,29 +311,6 @@ gtk_widget_show (label); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, label); - /* Name */ - if (info->priv->info.file.fields & GP_FILE_INFO_NAME) { - label = gtk_label_new (_("Name:")); - gtk_widget_show (label); - gtk_label_set_justify (GTK_LABEL (label), - GTK_JUSTIFY_LEFT); - gtk_table_attach (GTK_TABLE (page), label, - 0, 1, 0, 1, GTK_FILL, 0, 0, 0); - gtk_misc_set_alignment (GTK_MISC (label), 0, 0); - - entry = gtk_entry_new (); - gtk_entry_set_max_length (GTK_ENTRY (entry), - sizeof (info->priv->info.file.name)); - gtk_widget_show (entry); - gtk_table_attach_defaults (GTK_TABLE (page), entry, - 1, 2, 0, 1); - gtk_entry_set_text (GTK_ENTRY (entry), - info->priv->info.file.name); - info->priv->entry_name = entry; - g_signal_connect (GTK_OBJECT (entry), "changed", - GTK_SIGNAL_FUNC (on_name_changed), info); - } - /* Mime type */ if (info->priv->info.file.fields & GP_FILE_INFO_TYPE) { label = gtk_label_new (_("MIME type:")); Modified: trunk/gtkam/src/gtkam-list.c =================================================================== --- trunk/gtkam/src/gtkam-list.c 2009-07-22 07:46:01 UTC (rev 12248) +++ trunk/gtkam/src/gtkam-list.c 2009-07-22 15:02:46 UTC (rev 12249) @@ -660,8 +660,12 @@ on_info_updated (GtkamInfo *info, GtkamInfoInfoUpdatedData *d, GtkamListInfoUpdatedData *data) { +#if 0 + /* FIXME: could change the name previously, cannot do + * it these days */ gtk_list_store_set (data->list->priv->store, data->iter, NAME_COLUMN, d->info.file.name, -1); +#endif } static void @@ -817,54 +821,6 @@ g_free (file); } -static void -on_edited (GtkCellRendererText *cell, const gchar *path, - const gchar *new_text, GtkamList *list) -{ - GtkTreeIter iter; - gchar *folder, *name; - GtkamCamera *camera; - CameraFileInfo info; - GtkWidget *s, *d; - int r; - - g_return_if_fail (GTKAM_IS_LIST (list)); - - g_return_if_fail (gtk_tree_model_get_iter_from_string ( - GTK_TREE_MODEL (list->priv->store), &iter, path)); - camera = gtkam_list_get_camera_from_iter (list, &iter); - folder = gtkam_list_get_folder_from_iter (list, &iter); - name = gtkam_list_get_name_from_iter (list, &iter); - - /* Name really changed? */ - if (!strcmp (name, new_text)) { - g_free (name); - g_free (folder); - return; - } - - s = gtkam_status_new (_("Changing name of '%s' to '%s'..."), - name, new_text); - g_signal_emit (G_OBJECT (list), signals[NEW_STATUS], 0, s); - memset (&info, 0, sizeof (CameraFileInfo)); - info.file.fields = GP_FILE_INFO_NAME; - strncpy (info.file.name, new_text, sizeof (info.file.name) - 1); - r = gp_camera_file_set_info (camera->camera, folder, name, info, - GTKAM_STATUS (s)->context->context); - if (r < 0) { - d = gtkam_error_new (r, GTKAM_STATUS (s)->context, NULL, - _("Could not change the name of '%s' to '%s'."), - name, new_text); - g_signal_emit (G_OBJECT (list), signals[NEW_DIALOG], 0, d); - g_object_unref (G_OBJECT (d)); - } else - gtk_list_store_set (list->priv->store, - &iter, NAME_COLUMN, new_text, -1); - gtk_object_destroy (GTK_OBJECT (s)); - g_free (folder); - g_free (name); -} - static GtkItemFactoryEntry mi[] = { {N_("/_View with..."), NULL, NULL, 0, "<Branch>"}, @@ -940,10 +896,8 @@ /* Column for file names */ renderer = gtk_cell_renderer_text_new (); col = gtk_tree_view_column_new_with_attributes (_("Name"), renderer, - "text", NAME_COLUMN, "editable", IS_EDITABLE_COLUMN, NULL); + "text", NAME_COLUMN, NULL); gtk_tree_view_append_column (GTK_TREE_VIEW (list), col); - g_signal_connect (G_OBJECT (renderer), "edited", - G_CALLBACK (on_edited), list); /* Column for file attrib */ renderer = gtk_cell_renderer_text_new (); Modified: trunk/gtkam/src/gtkam-save.c =================================================================== --- trunk/gtkam/src/gtkam-save.c 2009-07-22 07:46:01 UTC (rev 12248) +++ trunk/gtkam/src/gtkam-save.c 2009-07-22 15:02:46 UTC (rev 12249) @@ -250,18 +250,15 @@ } static int -save_file (GtkamSave *save, CameraFile *file, guint n) +save_file (GtkamSave *save, const char *filename, CameraFile *file, CameraFileType type, guint n) { gchar *full_path, *full_filename, *dirname, *msg, *number_filename; - const char *filename, *mime_type; - CameraFileType type; + const char *mime_type; const gchar *fsel_filename, *fsel_path, *prefix, *suffix; GtkWidget *dialog; int result; - gp_file_get_type (file, &type); gp_file_get_mime_type (file, &mime_type); - gp_file_get_name (file, &filename); fsel_path = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER_DIALOG (save)); @@ -354,7 +351,7 @@ gp_camera_exit (camera->camera, NULL); switch (result) { case GP_OK: - result = save_file (save, file, n); + result = save_file (save, name, file, type, n); break; case GP_ERROR_CANCEL: break; Modified: trunk/gtkam/src/gtkam-tree.c =================================================================== --- trunk/gtkam/src/gtkam-tree.c 2009-07-22 07:46:01 UTC (rev 12248) +++ trunk/gtkam/src/gtkam-tree.c 2009-07-22 15:02:46 UTC (rev 12249) @@ -421,8 +421,12 @@ s = gtkam_status_new (_("Uploading '%s' into " "folder '%s'..."), g_basename (path), folder); g_signal_emit (G_OBJECT (ud->tree), signals[NEW_STATUS], 0, s); - r = gp_camera_folder_put_file (c->camera, folder, file, +#ifdef HAVE_GP_PORT_INFO_GET_NAME + r = gp_camera_folder_put_file (c->camera, folder, basename(path), GP_FILE_TYPE_NORMAL, file, GTKAM_STATUS (s)->context->context); +#else + r = gp_camera_folder_put_file (c->camera, folder, file, GTKAM_STATUS (s)->context->context); +#endif if (c->multi) gp_camera_exit (c->camera, NULL); switch (r) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |