Progress bar in notification bar

by yakura y » Fri, 23 Apr 2010 08:04:57 GMT


Sponsored Links
 Hello everybody,

I would like to put a progress bar in the notification bar. The idea is
showing the progress bar while the program uploads a file to a server.
Everything else is ok, but I can not figure out how to refresh the progress
bar inside the notification. Does anybody knows any pattern to play with?

Thanks in advance.

--



Other Threads

1. how to use obexd sendfiles method?

#include <dbus/dbus-glib.h>
#include <stdio.h>
#include <stdlib.h>
#include "sms_features.h"

static void lose (const char *fmt, ...) G_GNUC_NORETURN G_GNUC_PRINTF
(1, 2);
static void lose_gerror (const char *prefix, GError *error)
G_GNUC_NORETURN;

static void release_val(gpointer data)
{
        GValue *val = (GValue *)data;
        g_value_unset(val);
        g_free(val);
}

GType sms_get_features_type(void)
{
        return dbus_g_type_get_map("GHashTable", G_TYPE_STRING,
G_TYPE_VALUE);
}

GHashTable *sms_create_features(const char * alphabet, int csm_num,
int csm_seq)
{
        GHashTable *hash;
        GValue *val;

        hash = g_hash_table_new_full  (g_str_hash, NULL, NULL, release_val);

        val = g_new0(GValue, 1);
        g_value_init (val, G_TYPE_STRING);
        g_value_set_string (val, alphabet);
        g_hash_table_insert(hash, "alphabet", val);

        val = g_new0(GValue, 1);
        g_value_init (val, G_TYPE_INT);
        g_value_set_int (val, csm_num);
        g_hash_table_insert(hash, "csm_num", val);

        val = g_new0(GValue, 1);
        g_value_init (val, G_TYPE_INT);
        g_value_set_int (val, csm_seq);
        g_hash_table_insert(hash, "csm_seq", val);

        return hash;
}



static void
lose (const char *str, ...)
{
  va_list args;

  va_start (args, str);

  vfprintf (stderr, str, args);
  fputc ('\n', stderr);

  va_end (args);

  exit (1);
}

static void
lose_gerror (const char *prefix, GError *error)
{
  lose ("%s: %s", prefix, error->message);
}

static void
print_hash_value (gpointer key, gpointer val, gpointer data)
{
  printf ("%s -> %s\n", (char *) key, (char *) val);
}

int
main (int argc, char **argv)
{
  DBusGConnection *bus;
  DBusGProxy *remote_object;
  DBusGProxy *remote_object_introspectable;
  GError *error = NULL;
  char *introspect_data;
  guint i;
  gint sum;

  g_type_init ();

  {
    GLogLevelFlags fatal_mask;

    fatal_mask = g_log_set_always_fatal (G_LOG_FATAL_MASK);
    fatal_mask |= G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL;
    g_log_set_always_fatal (fatal_mask);
  }

  bus = dbus_g_bus_get (/*DBUS_BUS_SYSTEM*/DBUS_BUS_SESSION, &error);
  if (!bus)
    lose_gerror ("Couldn't connect to session bus", error);

  remote_object = dbus_g_proxy_new_for_name (bus,
                                             "org.openobex.client",
                                             "/",
                                             "org.openobex.Client");


  GHashTable *features;

  features = sms_create_features ("Destination", 3, 6);


  if (!dbus_g_proxy_call (remote_object, "SendFiles", &error,
                          sms_get_features_type(), features, G_TYPE_STRV, argv,
DBUS_TYPE_G_OBJECT_PATH, "/", G_TYPE_INVALID,
                          G_TYPE_INVALID))
    lose_gerror ("Failed to call Add", error);
  printf("sum is %d\n", sum);


  g_free (introspect_data);

  g_object_unref (G_OBJECT (remote_object_introspectable));
  g_object_unref (G_OBJECT (remote_object));

  exit(0);
}
when I run it:
[...@localhost src]$ ./example-client 00:13:E0:06:01:C1 /home/lm/
download/hello-dbus3-0.1/src/example-client.c
Failed to call Add:

The error value is NULL,but the dbus_g_proxy_call() return 0. I don't
know how to deal this problem. Is there someone know this? thanks.

the sendfiles method define in obexd like this:
{ "SendFiles", "a{sv}aso", "", send_files,
                                                G_DBUS_METHOD_FLAG_ASYNC },

--~--~---------~--~----~------------~-------~--~----~

2. Already set up G1 (unlocked) with Gmail account now I want to set it up to use my "Google Apps" custom domain acct

A few questions:

1. I aready set up my G1 with my @gmail.com account but now I want to
set it up with my @mydomain.com account that is hosted in Google Apps.

2. How can I set up so that it uses my Google Apps email account
(custom domain) for email and my gmail for  Google Calendar/Google
Voice?

--~--~---------~--~----~------------~-------~--~----~

3. .apk file failed to uploan on emulator

4. How to manually change GSM operator (carrier)

5. Can I add a data column to the Contacts db?

6. Can I add a data column to the Contacts db?

7. Launching Settings