1 /* 2 * 3 * File: main.h 4 * 5 * Copyright (C) 2009-2013 Darran Kartaschew 6 * 7 * This file is part of the gMTP package. 8 * 9 * gMTP is free software; you can redistribute it and/or modify 10 * it under the terms of the BSD License as included within the 11 * file 'COPYING' located in the root directory 12 * 13 */ 14 15 #ifndef _MAIN_H 16 #define _MAIN_H 17 18 #ifdef HAVE_CONFIG_H 19 #include "config.h" 20 #endif 21 22 #include <glib.h> 23 #include <gtk/gtk.h> 24 #include <glib/gi18n.h> 25 #include <libmtp.h> 26 27 #define UNUSED(x) (void)(x) 28 29 #ifdef __cplusplus 30 extern "C" { 31 #endif 32 33 // Main Device information struct. 34 35 typedef struct { 36 gboolean deviceConnected; 37 gint numrawdevices; 38 gint rawdeviceID; 39 gint storagedeviceID; 40 41 LIBMTP_raw_device_t * rawdevices; 42 LIBMTP_mtpdevice_t *device; 43 LIBMTP_devicestorage_t *devicestorage; 44 LIBMTP_error_number_t err; 45 46 GString *devicename; 47 GString *manufacturername; 48 GString *modelname; 49 GString *serialnumber; 50 GString *deviceversion; 51 //GString *syncpartner; 52 //GString *sectime; 53 GString *devcert; 54 55 // Raw device 56 GString *Vendor; 57 GString *Product; 58 uint32_t VendorID; 59 uint32_t ProductID; 60 uint32_t DeviceID; 61 uint32_t BusLoc; 62 63 uint16_t *filetypes; 64 uint16_t filetypes_len; 65 uint8_t maxbattlevel; 66 uint8_t currbattlevel; 67 68 } Device_Struct; 69 70 // Main Window Widgets. 71 GtkWidget *windowMain; 72 GtkWidget *scrolledwindowMain; 73 74 GtkWidget *windowStatusBar; 75 GtkWidget *toolbuttonConnect; 76 GtkWidget *treeviewFiles; 77 GtkWidget *treeviewFolders; 78 // Folder view; 79 GtkWidget *scrolledwindowFolders; 80 GtkTreeSelection *folderSelection; 81 82 // Device information struct 83 Device_Struct DeviceMgr; 84 85 // File/Folder/Track/Playlist pointers 86 LIBMTP_file_t *deviceFiles; 87 LIBMTP_folder_t *deviceFolders; 88 LIBMTP_track_t *deviceTracks; 89 LIBMTP_playlist_t *devicePlayLists; 90 uint32_t currentFolderID; // This is the ID of the current folder.... 91 int32_t addTrackPlaylistID; 92 93 GQueue *stackFolderIDs; 94 GQueue *stackFolderNames; 95 96 // Icon file locations. 97 gchar *file_logo_png; 98 gchar *file_icon48_png; 99 gchar *file_icon16_png; 100 gchar *file_about_png; 101 gchar *file_format_png; 102 // File view Icons 103 gchar *file_audio_png; 104 gchar *file_video_png; 105 gchar *file_playlist_png; 106 gchar *file_album_png; 107 gchar *file_textfile_png; 108 gchar *file_generic_png; 109 gchar *file_folder_png; 110 gchar *file_image_png; 111 112 /** 113 * setFilePaths - set paths for image used within gMTP 114 * @param argc 115 * @param argv 116 */ 117 gchar * setFilePaths(int argc, char *argv[]); 118 /** 119 * getRuntimePath - Returns the path which the application was run from 120 * @param argc 121 * @param argv 122 * @return pointer to string with location of the binary. 123 */ 124 gchar *getRuntimePath(int argc, char *argv[]); 125 126 // Common magic numbers. 127 128 #define KILOBYTE 1024 129 #define MEGABYTE 1048576 130 #define GIGABYTE 1073741824 131 132 #define GMTP_REQUIRE_PLAYLIST -2 133 #define GMTP_NO_PLAYLIST -1 134 #define GMTP_MAX_STRING 8192 135 136 #ifdef __cplusplus 137 } 138 #endif 139 140 #endif /* _MAIN_H */ 141