[4f31b9]: test.c  Maximize  Restore  History

Download this file

111 lines (100 with data), 5.1 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
/*
gcc -o test -DGDU_API_IS_SUBJECT_TO_CHANGE -DGDU_GTK_API_IS_SUBJECT_TO_CHANGE \
-Wall -g `pkg-config --cflags --libs gdu gdk-pixbuf-2.0` test.c
*/
/*
rox-media (Media) - DeviceKit-disks utility for ROX
Copyright (C) 2009 Tony Houghton <h@realh.co.uk>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <gtk/gtk.h>
#include <gdu-gtk/gdu-gtk.h>
int main(int argc, char **argv)
{
gtk_init(&argc, &argv);
GduPool *pool = gdu_pool_new();
g_return_val_if_fail(pool != NULL, 1);
GList *presentables = gdu_pool_get_presentables(pool);
GList *node;
for (node = presentables; node; node = g_list_next(node))
{
GduPresentable *presentable = GDU_PRESENTABLE(node->data);
if (!presentable) continue;
GduDevice *gd = gdu_presentable_get_device(presentable);
g_print("Found presentable device: %s\n",
gdu_presentable_get_id(presentable));
g_print(" Presentable name: %s\n",
gdu_presentable_get_name(presentable));
g_print(" Presentable description: %s\n",
gdu_presentable_get_description(presentable));
g_print(" VPD name: %s\n",
gdu_presentable_get_vpd_name(presentable));
g_print(" Device file: %s\n",
gdu_device_get_device_file(gd));
g_print(" is a volume: %d\n",
GDU_IS_VOLUME(presentable));
g_print(" is_recognized: %d\n",
gdu_presentable_is_recognized(presentable));
g_print(" is_drive: %d\n",
gdu_device_is_drive(gd));
g_print(" is_partition: %d\n",
gdu_device_is_partition(gd));
g_print(" is_removable: %d\n",
gdu_device_is_removable(gd));
g_print(" is_media_available: %d\n",
gdu_device_is_media_available(gd));
g_print(" is_media_change_detected: %d\n",
gdu_device_is_media_change_detected(gd));
g_print(" is_media_change_detection_polling: %d\n",
gdu_device_is_media_change_detection_polling(gd));
g_print(" is_media_change_detection_inhibitable: %d\n",
gdu_device_is_media_change_detection_inhibitable(gd));
g_print(" is_media_change_detection_inhibited: %d\n",
gdu_device_is_media_change_detection_inhibited(gd));
g_print(" is_drive: %d\n",
gdu_device_is_drive(gd));
g_print(" usage: %s\n",
gdu_device_id_get_usage(gd));
g_print(" type: %s\n",
gdu_device_id_get_type(gd));
g_print(" device size: %"
G_GUINT64_FORMAT "\n",
gdu_device_get_size(gd));
g_print(" block size: %"
G_GUINT64_FORMAT "\n",
gdu_device_get_block_size(gd));
g_print(" partition size: %"
G_GUINT64_FORMAT "\n",
gdu_device_partition_get_size(gd));
g_print(" presentable size: %"
G_GUINT64_FORMAT "\n",
gdu_presentable_get_size(presentable));
g_print(" partition size: %"
G_GUINT64_FORMAT "\n",
gdu_device_partition_get_size(gd));
g_print(" is_optical_disc: %d\n",
gdu_device_is_optical_disc(gd));
if (gdu_device_is_drive(gd))
{
g_print(" drive media %s\n",
gdu_device_drive_get_media(gd));
g_print(" drive is_media_ejectable %d\n",
gdu_device_drive_get_is_media_ejectable(gd));
g_print(" drive requires_eject %d\n",
gdu_device_drive_get_requires_eject(gd));
g_print(" drive can_detach %d\n",
gdu_device_drive_get_can_detach(gd));
}
}
return 0;
}

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks