Re: Displaying the information of the MMC card and the phone memory

2010-05-12 Thread Ram Kurvakat
not sure if you are using the QT framework for writing your code.
have you considered using the QT mobility framework, its still beta, but seems 
close to completion/delivery.

 *for storage device info.*
http://doc.qt.nokia.com/qtmobility-1.0/qsystemstorageinfo.html 
http://doc.qt.nokia.com/qtmobility-1.0/qsystemstorageinfo.html 

 *status of the api's*
http://doc.qt.nokia.com/qtmobility-1.0/index.html#platform-compatability 
http://doc.qt.nokia.com/qtmobility-1.0/index.html#platform-compatability 
http://qt.nokia.com/developer/new-qt-apis 
http://qt.nokia.com/developer/new-qt-apis 


if you arent using QT, then how about some command line stuff ?
http://wiki.maemo.org/Desktop_Command_Execution_Widget_scripts#Disk_usage 
http://wiki.maemo.org/Desktop_Command_Execution_Widget_scripts#Disk_usage 

you could also use hal-device command to get various device info.

cheers
krk969



- Original Message -
From: Pallavi Kandhare
Sent: 05/12/10 06:39 AM
To: maemo-developers@maemo.org
Subject: Displaying the information of the MMC card and the phone memory

Hi All
I want to write code in Maemo for the foll: 
1. Displaying the information of the MMC card and the phone memory 
(ie. used space, free space)

When i use functions in libhal-storage.h i get an error: undefined reference to 
function_name

2. On mobile certain aplications are running at a time. (ed. clock, calender 
etc). How can i find out and list all these applications.

Can anybody help me with the API or any info in this matter?

Regards.
___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: Displaying the information of the MMC card and the phone memory

2010-05-12 Thread Daniil Ivanov
Hi Pallavi!

On Wed, May 12, 2010 at 8:39 AM, Pallavi Kandhare
pallavi.kandh...@yahoo.com wrote:

 Hi All
 I want to write code in Maemo for the foll:
 1. Displaying the information of the MMC card and the phone memory
 (ie. used space, free space)

 When i use functions in libhal-storage.h i get an error: undefined reference 
 to function_name

 Where are you using libhal-storage? Did you include output of
$(pkg-config --libs hal-storage) to appropriate place
 of what you are using?


 2. On mobile certain aplications are running at a time. (ed. clock, calender 
 etc). How can i find out and list all these applications.

 ps -e
 shows all active processes including all applications. hildon-desktop
definitely knows it as it shows all apps in dashboard,
 however, I'm not sure there is an API available for this purpose.

 Can anybody help me with the API or any info in this matter?

 Regards.

 ___
 maemo-developers mailing list
 maemo-developers@maemo.org
 https://lists.maemo.org/mailman/listinfo/maemo-developers


  @Ram:
  The name of framework is Qt. QT is Apple's QuickTime.

Thanks, Daniil
___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: Displaying the information of the MMC card and the phone memory

2010-05-12 Thread Kimmo Hämäläinen
Hi,

On Wed, 2010-05-12 at 07:39 +0200, ext Pallavi Kandhare wrote:
..


 2. On mobile certain aplications are running at a time. (ed. clock,
calender etc). How 
 can i find out and list all these applications.
  


There is nothing very convenient for this but you can do it using the
same API as the window manager (hildon-desktop) uses: XQueryTree and
reading some window properties with XGetWindowProperty.  You could get a
some kind of list by taking top-level (== parent is the root window)
windows that have _NET_WM_WINDOW_TYPE property set to
_NET_WM_WINDOW_TYPE_NORMAL.

I'm attaching the source code of a small utility that uses XQueryTree,
you could use it as a starting point.

-Kimmo
#include X11/Xlib.h
#include X11/Xatom.h
#include stdio.h
#include stdlib.h
#include string.h

static Atom class_atom, name_atom, name_atom2, xembed_atom, pid_atom,
trans_atom, hildon_stack_atom,
utf8_string_atom,
	current_app_atom, win_type_atom, wm_state_atom, theme_atom,
portrait_support, portrait_request, non_comp_atom;

static char *get_atom_prop(Display *dpy, Window w, Atom atom)
{ 
  Atom type;
  int format, rc;
  unsigned long items;
  unsigned long left;
  Atom *value;
	  char *copy;

  rc = XGetWindowProperty (dpy, w, atom, 0, 1, False,
  XA_ATOM, type, format,
  items, left, (unsigned char**)value);
  if (type != XA_ATOM || format == 0 || rc != Success) {
	copy = strdup();
	  } else {
	char *s = XGetAtomName(dpy, *value);
	copy = strdup(s);
	XFree(s);
  }
  return copy;
}

static Window get_win_prop(Display *dpy, Window w, Atom atom)
{ 
  Atom type;
  int format, rc;
  unsigned long items;
  unsigned long left;
  Window *value;

  rc = XGetWindowProperty (dpy, w, atom, 0, 1, False,
  XA_WINDOW, type, format,
  items, left, (unsigned char**)value);
  if (type == None || rc != Success)
return 0;
  else
  {
return *value;
  }
}

static unsigned long get_card_prop(Display *dpy, Window w, Atom atom)
{ 
  Atom type;
  int format, rc;
  unsigned long items;
  unsigned long left;
  unsigned long *value;

  rc = XGetWindowProperty (dpy, w, atom, 0, 1, False,
  XA_CARDINAL, type, format,
  items, left, (unsigned char**)value);
  if (type == None || rc != Success)
return 0;
  else
  {
return *value;
  }
}

static long get_int_prop(Display *dpy, Window w, Atom atom)
{ 
  Atom type;
  int format, rc;
  unsigned long items;
  unsigned long left;
  unsigned long *value;

  rc = XGetWindowProperty (dpy, w, atom, 0, 1, False,
  XA_INTEGER, type, format,
  items, left, (unsigned char**)value);
  if (type == None || rc != Success)
return -1;
  else
  {
return *value;
  }
}

static long get_xembed_prop(Display *dpy, Window w)
{ 
  Atom type;
  int format, rc;
  unsigned long items;
  unsigned long left;
  unsigned long *value;

  rc = XGetWindowProperty (dpy, w, xembed_atom, 0, 2, False,
  XA_CARDINAL, type, format,
  items, left, (unsigned char**)value);
  if (type == None || rc != Success)
return -1;
  else
  {
	long ret;
	ret = value[1]  (1  0);
	XFree(value);
return ret;
  }
}

static char *get_str_prop(Display *dpy, Window w, Atom atom)
{ 
  Atom type;
  int format, rc;
  unsigned long items;
  unsigned long left;
  char *value;

  rc = XGetWindowProperty (dpy, w, atom, 0, 200, False,
  XA_STRING, type, format,
  items, left, (unsigned char**)value);
  if (type == None || rc != Success)
return NULL;
  else
  {
char *s = strdup((const char*)value);
	XFree(value);
return s;
  }
}

static char *get_utf8_prop(Display *dpy, Window w, Atom atom)
{ 
  Atom type;
  int format, rc;
  unsigned long items;
  unsigned long left;
  char *value;

  rc = XGetWindowProperty (dpy, w, atom, 0, 200, False,
   utf8_string_atom, type, format,
   items, left, (unsigned char**)value);
  if (type == None || rc != Success)
return NULL;
  else
  {
char *s = strdup((const char*)value);
	XFree(value);
return s;
  }
}

static const char