Esempio n. 1
0
void
gtkam_chooser_set_camera (GtkamChooser *chooser, GtkamCamera *camera)
{
	CameraAbilities a;
	GPPortInfo info;
	gchar *full_info;
#ifdef HAVE_GP_PORT_INFO_GET_NAME
	char *xname,*xpath;
#endif

	g_return_if_fail (GTKAM_IS_CHOOSER (chooser));
	g_return_if_fail (GTKAM_IS_CAMERA (camera));

	gp_camera_get_abilities (camera->camera, &a);
	gp_camera_get_port_info (camera->camera, &info);
#ifdef HAVE_GP_PORT_INFO_GET_NAME
	gp_port_info_get_name (info, &xname);
	gp_port_info_get_path (info, &xpath);
	full_info = g_strdup_printf ("%s (%s)", xname, xpath);
#else
	full_info = g_strdup_printf ("%s (%s)", info.name, info.path);
#endif
	gtk_entry_set_text (chooser->priv->entry_port, full_info);
	g_free (full_info);

	gtk_entry_set_text (chooser->priv->entry_model, a.model);
	gtk_toggle_button_set_active (
		GTK_TOGGLE_BUTTON (chooser->priv->check_multi), camera->multi);

	chooser->priv->needs_update = FALSE;
	gtk_widget_set_sensitive (chooser->apply_button, FALSE);
}
Esempio n. 2
0
static void
on_port_added (GtkamPort *port, const gchar *path, GtkamChooser *chooser)
{
	int index;
	GPPortInfo info;
	gchar *name;
#ifdef HAVE_GP_PORT_INFO_GET_NAME
	char *xname, *xpath;
#endif

	index = gp_port_info_list_lookup_path (chooser->priv->il, path);
	if (index < 0) {
		g_warning ("Could not look up path?!?");
		return;
	}
	gp_port_info_list_get_info (chooser->priv->il, index, &info);
#ifdef HAVE_GP_PORT_INFO_GET_NAME
	gp_port_info_get_name (info, &xname);
	gp_port_info_get_path (info, &xpath);
	name = g_strdup_printf ("%s (%s)", xname, xpath);
#else
	name = g_strdup_printf ("%s (%s)", info.name, info.path);
#endif
	gtk_entry_set_text (chooser->priv->entry_port, name);
	g_free (name);

	gtkam_chooser_update_for_model (chooser);

	chooser->priv->needs_update = TRUE;
	gtk_widget_set_sensitive (chooser->apply_button, TRUE);
}
Esempio n. 3
0
void
gtkam_chooser_set_port_mask (GtkamChooser *chooser, GPPortType types)
{
	GtkWidget *dialog;
	GPPortInfo info;
	int n;
	guint i;
	GList *list = NULL;

	g_return_if_fail (GTKAM_IS_CHOOSER (chooser));

	n = gp_port_info_list_count (chooser->priv->il);
	if (n < 0) {
		dialog = gtkam_error_new (n, NULL, GTK_WIDGET (chooser),
			_("Could not get number of ports."));
		gtk_widget_show (dialog);
		return;
	}

	/* Search for ports that fulfil the criteria */
	for (i = 0; i < n; i++) {
#ifdef HAVE_GP_PORT_INFO_GET_NAME
		GPPortType type;
		char *xname,*xpath;
#endif
		gp_port_info_list_get_info (chooser->priv->il, i, &info);
#ifdef HAVE_GP_PORT_INFO_GET_NAME
		gp_port_info_get_type (info, &type);
		gp_port_info_get_name (info, &xname);
		gp_port_info_get_path (info, &xpath);
		if (type & types)
			list = g_list_append (list, g_strdup_printf ("%s (%s)",
					      xname, xpath));
#else
		if (info.type & types)
			list = g_list_append (list, g_strdup_printf ("%s (%s)",
					      info.name, info.path));
#endif
	}

	gtkam_chooser_set_port_list (chooser, list);
}
Esempio n. 4
0
int
gp_camera_set_port_info (Camera *camera, GPPortInfo info)
{
	char	*name, *path;
	C_PARAMS (camera);

	/*
	 * If the camera is currently initialized, terminate that connection.
	 * We don't care if we are successful or not.
	 */
	if (camera->pc->lh)
		gp_camera_exit (camera, NULL);

	gp_port_info_get_name (info, &name);
	gp_port_info_get_path (info, &path);
	GP_LOG_D ("Setting port info for port '%s' at '%s'...", name, path);
	CR (camera, gp_port_set_info (camera->port, info), NULL);

	return (GP_OK);
}
Esempio n. 5
0
void GPCamera::getSupportedPorts(QStringList& plist)
{
#ifdef HAVE_GPHOTO2
    GPPortInfoList* list = 0;
    GPPortInfo      info;

    plist.clear();

    gp_port_info_list_new(&list);
    gp_port_info_list_load(list);

    int numPorts = gp_port_info_list_count(list);

    if (numPorts < 0)
    {
        qCDebug(DIGIKAM_IMPORTUI_LOG) << "Failed to get list of port!";
        printGphotoErrorDescription(numPorts);
        gp_port_info_list_free(list);
        return;
    }
    else
    {
        for (int i = 0 ; i < numPorts ; i++)
        {
            gp_port_info_list_get_info(list, i, &info);
#ifdef HAVE_GPHOTO25
            char* xpath = 0;
            gp_port_info_get_name (info, &xpath);
            plist.append(QString::fromUtf8(xpath));
#else
            plist.append(info.path);
#endif
        }
    }

    gp_port_info_list_free(list);
#else
    Q_UNUSED(plist);
#endif /* HAVE_GPHOTO2 */
}