--- Begin Message ---
Author: andrew
Date: 2007-04-03 16:17:53 +0200 (Tue, 03 Apr 2007)
New Revision: 1647
Modified:
trunk/src/host/qemu-neo1973/hw/neo1973.c
trunk/src/host/qemu-neo1973/hw/s3c.h
trunk/src/host/qemu-neo1973/hw/s3c2410.c
trunk/src/host/qemu-neo1973/openmoko/download.sh
trunk/src/host/qemu-neo1973/openmoko/env
trunk/src/host/qemu-neo1973/openmoko/flash.sh
trunk/src/host/qemu-neo1973/vl.h
Log:
Allow multiple devices on each UART, add modem ioctls.
Invert GSM power-on signal.
Explicitely use bash and GNU make in scripts. (GNU echo is still needed so
we're not 100% BSD-friendly yet)
Modified: trunk/src/host/qemu-neo1973/hw/neo1973.c
===================================================================
--- trunk/src/host/qemu-neo1973/hw/neo1973.c 2007-04-03 13:36:14 UTC (rev
1646)
+++ trunk/src/host/qemu-neo1973/hw/neo1973.c 2007-04-03 14:17:53 UTC (rev
1647)
@@ -100,7 +100,7 @@
static void neo_gsm_switch(int line, int level, void *opaque)
{
- neo_printf("GSM %sabled.\n", level ? "en" : "dis");
+ neo_printf("GSM %sabled.\n", level ? "dis" : "en");
}
static void neo_bt_switch(int line, int level, void *opaque)
Modified: trunk/src/host/qemu-neo1973/hw/s3c.h
===================================================================
--- trunk/src/host/qemu-neo1973/hw/s3c.h 2007-04-03 13:36:14 UTC (rev
1646)
+++ trunk/src/host/qemu-neo1973/hw/s3c.h 2007-04-03 14:17:53 UTC (rev
1647)
@@ -109,8 +109,8 @@
struct s3c_uart_state_s;
struct s3c_uart_state_s *s3c_uart_init(target_phys_addr_t base,
- void *pic, void *dma, int irq[], int drq[],
- CharDriverState *chr);
+ void *pic, void *dma, int irq[], int drq[]);
+void s3c_uart_attach(struct s3c_uart_state_s *s, CharDriverState *chr);
struct s3c_adc_state_s;
struct s3c_adc_state_s *s3c_adc_init(target_phys_addr_t base, void *pic);
Modified: trunk/src/host/qemu-neo1973/hw/s3c2410.c
===================================================================
--- trunk/src/host/qemu-neo1973/hw/s3c2410.c 2007-04-03 13:36:14 UTC (rev
1646)
+++ trunk/src/host/qemu-neo1973/hw/s3c2410.c 2007-04-03 14:17:53 UTC (rev
1647)
@@ -1049,7 +1049,9 @@
uint8_t rxfifo[16];
int rxstart;
int rxlen;
- CharDriverState *chr;
+#define UART_MAX_CHR 4
+ int chr_num;
+ CharDriverState *chr[UART_MAX_CHR];
uint8_t lcontrol;
uint8_t fcontrol;
@@ -1074,6 +1076,7 @@
static void s3c_uart_params_update(struct s3c_uart_state_s *s)
{
QEMUSerialSetParams ssp;
+ int i;
if (!s->chr)
return;
@@ -1097,7 +1100,8 @@
ssp.stop_bits = (s->lcontrol & (1 << 2)) ? 2 : 1;
- qemu_chr_ioctl(s->chr, CHR_IOCTL_SERIAL_SET_PARAMS, &ssp);
+ for (i = 0; i < s->chr_num; i ++)
+ qemu_chr_ioctl(s->chr[i], CHR_IOCTL_SERIAL_SET_PARAMS, &ssp);
}
static void s3c_uart_err(struct s3c_uart_state_s *s, int err)
@@ -1234,6 +1238,7 @@
{
struct s3c_uart_state_s *s = (struct s3c_uart_state_s *) opaque;
uint8_t ch;
+ int i, afc;
addr -= s->base;
switch (addr) {
@@ -1256,12 +1261,17 @@
s->fcontrol = value & 0xf1;
break;
case S3C_UMCON:
- s->mcontrol = value & 0xe1;
+ if ((s->mcontrol ^ value) & (1 << 4)) {
+ afc = (value >> 4) & 1;
+ for (i = 0; i < s->chr_num; i ++)
+ qemu_chr_ioctl(s->chr[i], CHR_IOCTL_MODEM_SET_AFC, &afc);
+ }
+ s->mcontrol = value & 0x11;
break;
case S3C_UTXH:
ch = value & 0xff;
- if (s->chr)
- qemu_chr_write(s->chr, &ch, 1);
+ for (i = 0; i < s->chr_num; i ++)
+ qemu_chr_write(s->chr[i], &ch, 1);
s3c_uart_empty(s);
break;
case S3C_UBRDIV:
@@ -1286,8 +1296,7 @@
};
struct s3c_uart_state_s *s3c_uart_init(target_phys_addr_t base,
- void *pic, void *dma, int irq[], int drq[],
- CharDriverState *chr)
+ void *pic, void *dma, int irq[], int drq[])
{
int iomemtype;
struct s3c_uart_state_s *s = (struct s3c_uart_state_s *)
@@ -1298,7 +1307,6 @@
s->dma = dma;
s->irq = irq;
s->drq = drq;
- s->chr = chr;
s3c_uart_reset(s);
@@ -1306,13 +1314,19 @@
s3c_uart_writefn, s);
cpu_register_physical_memory(s->base, 0xfff, iomemtype);
- if (chr)
- qemu_chr_add_read_handler(chr, s3c_uart_is_empty, s3c_uart_rx, s);
- /* S3C2410 UART doesn't seem to understand break conditions. */
-
return s;
}
+void s3c_uart_attach(struct s3c_uart_state_s *s, CharDriverState *chr)
+{
+ if (s->chr_num >= UART_MAX_CHR)
+ cpu_abort(cpu_single_env, "%s: Too many devices\n", __FUNCTION__);
+ s->chr[s->chr_num ++] = chr;
+
+ qemu_chr_add_read_handler(chr, s3c_uart_is_empty, s3c_uart_rx, s);
+ /* S3C2410 UART doesn't seem to understand break conditions. */
+}
+
/* ADC & Touchscreen interface */
struct s3c_adc_state_s {
target_phys_addr_t base;
@@ -2189,10 +2203,12 @@
s3c_nand_writefn, s);
cpu_register_physical_memory(s->nand_base, 0xffffff, iomemtype);
- for (i = 0; s3c2410_uart[i].base; i ++)
+ for (i = 0; s3c2410_uart[i].base; i ++) {
s->uart[i] = s3c_uart_init(s3c2410_uart[i].base, s->pic, s->dma,
- s3c2410_uart[i].irq, s3c2410_uart[i].dma,
- serial_hds[i]);
+ s3c2410_uart[i].irq, s3c2410_uart[i].dma);
+ if (serial_hds[i])
+ s3c_uart_attach(s->uart[i], serial_hds[i]);
+ }
s->timers = s3c_timers_init(0x51000000, s->pic, s->dma);
Modified: trunk/src/host/qemu-neo1973/openmoko/download.sh
===================================================================
--- trunk/src/host/qemu-neo1973/openmoko/download.sh 2007-04-03 13:36:14 UTC
(rev 1646)
+++ trunk/src/host/qemu-neo1973/openmoko/download.sh 2007-04-03 14:17:53 UTC
(rev 1647)
@@ -1,4 +1,4 @@
-#! /bin/sh
+#! /bin/bash
# Chooses and downloads some OpenMoko image snapshots for flash.sh to use.
#
# Copyright (C) 2007 OpenMoko, Inc.
Modified: trunk/src/host/qemu-neo1973/openmoko/env
===================================================================
--- trunk/src/host/qemu-neo1973/openmoko/env 2007-04-03 13:36:14 UTC (rev
1646)
+++ trunk/src/host/qemu-neo1973/openmoko/env 2007-04-03 14:17:53 UTC (rev
1647)
@@ -7,6 +7,7 @@
qemu_relative="arm-softmmu/qemu-system-arm -M neo -m 130"
qemu="$src_dir/$qemu_relative"
flash_image=openmoko-flash.image
+make=gmake
kernel_addr=0x32000000
splash_addr=0x36000000
Modified: trunk/src/host/qemu-neo1973/openmoko/flash.sh
===================================================================
--- trunk/src/host/qemu-neo1973/openmoko/flash.sh 2007-04-03 13:36:14 UTC
(rev 1646)
+++ trunk/src/host/qemu-neo1973/openmoko/flash.sh 2007-04-03 14:17:53 UTC
(rev 1647)
@@ -1,4 +1,4 @@
-#! /bin/sh
+#! /bin/bash
# Generates a ready to use OpenMoko NAND flash image. Vaguely based
# on devirginator and http://wiki.openmoko.org/wiki/NAND_bad_blocks.
#
@@ -31,7 +31,7 @@
exit -1
fi
-make splash.gz || exit -1
+${make} splash.gz || exit -1
# Find the most recent OpenMoko images in the current directory.
# We assume they have numeric date or some build number in their names.
@@ -56,7 +56,7 @@
ln -s $script_dir_relative/$uboot_image $uboot_symlink
rm -rf $flash_image
-make $flash_image || exit -1
+${make} $flash_image || exit -1
# Launch the emulator assuming that u-boot is now functional enough
# for us to be able to issue u-boot commands.
Modified: trunk/src/host/qemu-neo1973/vl.h
===================================================================
--- trunk/src/host/qemu-neo1973/vl.h 2007-04-03 13:36:14 UTC (rev 1646)
+++ trunk/src/host/qemu-neo1973/vl.h 2007-04-03 14:17:53 UTC (rev 1647)
@@ -292,6 +292,8 @@
#define CHR_IOCTL_PP_WRITE_CONTROL 6
#define CHR_IOCTL_PP_READ_STATUS 7
+#define CHR_IOCTL_MODEM_SET_AFC 8
+
typedef void IOEventHandler(void *opaque, int event);
typedef struct CharDriverState {
--- End Message ---
--- Begin Message ---
Author: zhiyong_sun
Date: 2007-04-04 05:52:48 +0200 (Wed, 04 Apr 2007)
New Revision: 1649
Modified:
trunk/src/target/OM-2007/applications/openmoko-taskmanager/ChangeLog
trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/callbacks.c
trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/list_view.c
trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/list_view.h
trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/taskmanager.c
Log:
openmoko-taskmanager: use GtkIconView widget to show task list in a 3 colums
style, still have some small bugs(show the items which are hidden by moko
figner wheel and toolbox)
Modified: trunk/src/target/OM-2007/applications/openmoko-taskmanager/ChangeLog
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-taskmanager/ChangeLog
2007-04-03 14:22:48 UTC (rev 1648)
+++ trunk/src/target/OM-2007/applications/openmoko-taskmanager/ChangeLog
2007-04-04 03:52:48 UTC (rev 1649)
@@ -0,0 +1,22 @@
+2007-04-04 Sun Zhiyong <[EMAIL PROTECTED]>
+ * openmoko-taskmanager/src/list_view.c:
+ (moko_task_list_init), (moko_add_window),
+ (moko_update_store_list), (moko_set_list_highlight),
+ (moko_task_list_selection_changed):
+ Use GtkIconView widget to show active task list(3 columns style);
+ Add GtkIconView "selection_changed" callback function to send selected
application name to openmoko-footer.
+
+ * openmoko-taskmanger/src/list_view.h:
+ Add marcos, which are used for GtkIconView layout adjustment.
+
+ * openmoko-taskmanger/src/callbacks.c:
+ (moko_wm_cmd), (moko_kill_all_btn_cb),
+ (moko_wheel_left_up_press_cb),
+ (moko_wheel_right_down_press_cb),
+ (moko_wheel_bottom_press_cb):
+ Rewrite moko finger wheel "up left" and "right down" button callback
functions;
+ Add moko finger wheel bottom button press callback function to show
desktop;
+ Some modifies to fit GtkIconView widget.
+
+ * openmoko-taskmanager/src/taskmanager.c:
+ Add moko finger wheel bottom buttton press callback function.
Modified:
trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/callbacks.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/callbacks.c
2007-04-03 14:22:48 UTC (rev 1648)
+++ trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/callbacks.c
2007-04-04 03:52:48 UTC (rev 1649)
@@ -41,23 +41,25 @@
gboolean
moko_wm_cmd (MokoTaskManager *tm, GtkWidget *list_view, int task)
{
- GtkTreeSelection *sel = gtk_tree_view_get_selection (GTK_TREE_VIEW
(list_view));
- GtkTreeIter iter;
- GtkTreeModel *model;
+ GList *path = gtk_icon_view_get_selected_items (GTK_ICON_VIEW(list_view));
+ GtkTreeModel *model = gtk_icon_view_get_model (GTK_ICON_VIEW(list_view));
+ GtkTreeIter iter;
- if (gtk_tree_selection_get_selected (sel, &model, &iter))
- {
- Window w;
-
- gtk_tree_model_get (GTK_TREE_MODEL (model), &iter, OBJECT_COL, &w,
-1);
- mbcommand(GDK_DISPLAY(), task, w, NULL);
- return TRUE;
- }
- else
- {
- moko_dbus_send_message ("No application selected");
- return FALSE;
- }
+ if (gtk_tree_model_get_iter (model, &iter, path->data))
+ {
+ Window w;
+ gtk_tree_model_get (GTK_TREE_MODEL (model), &iter, OBJECT_COL, &w, -1);
+ mbcommand(GDK_DISPLAY(), task, w, NULL);
+ return TRUE;
+ }
+ else
+ {
+ moko_dbus_send_message ("No application selected");
+ return FALSE;
+ }
+
+ if (path)
+ g_list_free (path);
}
gboolean
@@ -87,14 +89,11 @@
void
moko_kill_all_btn_cb (GtkButton *btn, MokoTaskManager *tm)
{
- GtkTreeSelection *sel = gtk_tree_view_get_selection (GTK_TREE_VIEW
(tm->l->list_view));
GtkTreeIter iter;
- GtkTreeModel *model;
+ GtkTreeModel *model = gtk_icon_view_get_model (GTK_ICON_VIEW
(tm->l->list_view));
Window *win;
GSList *list = NULL;
- gtk_tree_selection_get_selected (sel, &model, &iter);
-
if (!gtk_tree_model_get_iter_first (model, &iter))
return;
@@ -125,95 +124,103 @@
gtk_window_iconify (GTK_WINDOW (tm->window));
moko_dbus_send_message ("");
}
-/*
+
void
-moko_tab_event_cb (GtkButton *btn, MokoTaskList *l)
+moko_wheel_left_up_press_cb (GtkWidget *self, MokoTaskManager *tm)
{
- g_debug ("tab event");
- GtkTreeIter iter;
- GtkTreePath *path;
- GtkTreeViewColumn *col;
- GtkTreeModel *model;
+ if (!tm->l->list_view)
+ return;
+
+ GtkTreeIter iter;
+ GtkTreeModel *model = gtk_icon_view_get_model (GTK_ICON_VIEW
(tm->l->list_view));
+ GList *path = gtk_icon_view_get_selected_items
(GTK_ICON_VIEW(tm->l->list_view));
- gtk_tree_view_get_cursor(GTK_TREE_VIEW (l->list_view), &path, &col);
- //gtk_tree_view_get_cursor(l->mokolist_view, &path, &col);
-
- model = GTK_TREE_MODEL (l->list_store);
-
- if (gtk_tree_model_get_iter (model, &iter, path)) {
- Window w;
- gtk_tree_model_get (model, &iter, OBJECT_COL, &w, -1);
- //moko_print_win_list(GDK_DISPLAY(), &w, 1);
- //moko_send_Xclimsgwm(GDK_DISPLAY (), w);
- mbcommand(GDK_DISPLAY(), CMD_ACTIVATE_WINDOW, w, NULL);
- }
- if (path)
- free (path);
+ if (!path && gtk_tree_model_get_iter_first (model, &iter))
+ {
+ GtkTreePath *new_path = NULL;
+ for (;gtk_tree_model_iter_next (model, &iter);)
+ {
+ if (new_path)
+ gtk_tree_path_free (new_path);
+ new_path = gtk_tree_model_get_path (model, &iter);
+ }
+ gtk_icon_view_select_path (GTK_ICON_VIEW (tm->l->list_view), new_path);
+ gtk_tree_path_free (new_path);
+ }
+ else if (path && gtk_tree_path_prev (path->data))
+ {
+ gtk_icon_view_select_path (GTK_ICON_VIEW (tm->l->list_view), path->data);
+ }
+ else
+ g_warning ("Can not find right path of icon view item");
+
+ if (path)
+ {
+ gtk_tree_path_free (path->data);
+ g_list_free (path);
+ }
+ return;
}
-void
-moko_hold_event_cb (GtkButton *btn, MokoTaskList *l)
+void
+moko_wheel_right_down_press_cb (GtkWidget *self, MokoTaskManager *tm)
{
+ if (!tm->l->list_view)
+ return;
+ GList* path = NULL;
+ GtkTreePath *new_path = NULL;
+ GtkTreeModel *model = gtk_icon_view_get_model (GTK_ICON_VIEW
(tm->l->list_view));
+ GtkTreeIter iter;
-}
-*/
-void
-moko_wheel_left_up_press_cb (GtkWidget *self, MokoTaskManager *tm)
-{
- GtkTreeSelection *selection;
- GtkTreeModel *model;
- GtkTreeIter iter;
- GtkTreePath* path;
+ path = gtk_icon_view_get_selected_items (GTK_ICON_VIEW(tm->l->list_view));
- if (!tm->l->list_view)
- return;
-
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tm->l->list_view));
-
- if (!gtk_tree_selection_get_selected (selection, &model, &iter))
- {
- moko_dbus_send_message ("");
- return;
- }
-
- path = gtk_tree_model_get_path (model, &iter);
- if (!gtk_tree_path_prev (path))
- {
- gtk_tree_path_free (path);
- return;
- }
-
- gtk_tree_view_set_cursor (GTK_TREE_VIEW (tm->l->list_view), path, 0, 0);
- gtk_tree_path_free (path);
- return;
+ if (path && gtk_tree_model_get_iter (model, &iter, path->data))
+ {
+ if (gtk_tree_model_iter_next (model, &iter))
+ new_path = gtk_tree_model_get_path (model, &iter);
+ gtk_tree_path_free (path->data);//FIXME: If not use _GTK_SELECTION_SINGLE_
as icon view selection model,
+ //here should use g_list_foreach (path,
gtk_tree_path_free, NULL)
+ //to free the tree path(es).
+ }
+ else if (gtk_tree_model_get_iter_first (model, &iter))
+ {
+ new_path = gtk_tree_model_get_path (model, &iter);
+ }
+ else
+ g_error ("Can not find right path of icon view item");
+
+ if (new_path)
+ {
+ gtk_icon_view_select_path (GTK_ICON_VIEW (tm->l->list_view), new_path);
+ gtk_tree_path_free (new_path);
+ }
+ g_list_free (path);
+
+ return;
}
void
-moko_wheel_right_down_press_cb (GtkWidget *self, MokoTaskManager *tm)
+moko_wheel_bottom_press_cb (GtkWidget *self, MokoTaskManager *tm)
{
- GtkTreeSelection *selection;
- GtkTreeModel *model;
- GtkTreeIter iter;
- GtkTreePath* path;
+ GtkWidget* widget = GTK_WIDGET(self);
+ Screen* screen = GDK_SCREEN_XSCREEN(gtk_widget_get_screen (widget));
+ XEvent xev;
- if (!tm->l->list_view)
- return;
-
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tm->l->list_view));
+ xev.xclient.type = ClientMessage;
+ xev.xclient.serial = 0;
+ xev.xclient.send_event = True;
+ xev.xclient.display = DisplayOfScreen (screen);
+ xev.xclient.window = RootWindowOfScreen (screen);
+ xev.xclient.message_type = gdk_x11_get_xatom_by_name( "_NET_SHOWING_DESKTOP"
);
+ xev.xclient.format = 32;
+ xev.xclient.data.l[0] = TRUE;
+ xev.xclient.data.l[1] = 0;
+ xev.xclient.data.l[2] = 0;
+ xev.xclient.data.l[3] = 0;
+ xev.xclient.data.l[4] = 0;
- if (!gtk_tree_selection_get_selected (selection, &model, &iter))
- {
- moko_dbus_send_message ("");
- return;
- }
-
- path = gtk_tree_model_get_path (model, &iter);
- gtk_tree_path_next (path);
-
- if (!path)
- return;
-
- gtk_tree_view_set_cursor (GTK_TREE_VIEW (tm->l->list_view), path, 0, 0);
- gtk_tree_path_free (path);
- return;
+ XSendEvent (DisplayOfScreen (screen), RootWindowOfScreen (screen), False,
+ SubstructureRedirectMask | SubstructureNotifyMask, &xev);
+
+ return;
}
Modified:
trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/list_view.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/list_view.c
2007-04-03 14:22:48 UTC (rev 1648)
+++ trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/list_view.c
2007-04-04 03:52:48 UTC (rev 1649)
@@ -30,6 +30,8 @@
static void moko_task_list_class_init (MokoTaskListClass *klass);
static void moko_task_list_init (MokoTaskList *l);
+static void moko_task_list_selection_changed (GtkIconView *self, MokoTaskList
*l);
+
static guint list_signals[LAST_SIGNAL] = { 0 };
/**
@@ -89,68 +91,33 @@
static void /* Instance Construction */
moko_task_list_init (MokoTaskList *l)
{
- GtkCellRenderer *renderer;
- GtkTreeViewColumn *column;
- // GtkWidget *ico;
- GtkWidget *align;
+ l->list_view = gtk_icon_view_new();
+ gtk_widget_set_name (l->list_view, "gtktreeview-black");
+ gtk_icon_view_set_columns (GTK_ICON_VIEW(l->list_view), COLUMN_NO);
+ gtk_icon_view_set_margin (GTK_ICON_VIEW(l->list_view), MARGIN);
+ gtk_icon_view_set_column_spacing (GTK_ICON_VIEW(l->list_view), COLUMN_SPACE);
+ gtk_icon_view_set_row_spacing (GTK_ICON_VIEW(l->list_view), ROW_SPACE);
+ gtk_icon_view_set_selection_mode (GTK_ICON_VIEW(l->list_view),
GTK_SELECTION_SINGLE);
+ gtk_widget_show (l->list_view);
+ l->list_store = gtk_list_store_new (3, G_TYPE_STRING, G_TYPE_INT,
GDK_TYPE_PIXBUF);
+ gtk_icon_view_set_pixbuf_column (GTK_ICON_VIEW(l->list_view), PIXBUF_COL);
+ gtk_icon_view_set_text_column (l->list_view, TEXT_COL );
+ gtk_icon_view_set_model (GTK_ICON_VIEW(l->list_view),
GTK_TREE_MODEL(l->list_store));
- align=gtk_alignment_new(0, 0, 1, 1);
- gtk_alignment_set_padding(GTK_ALIGNMENT (align), 0, 150, 0, 0);
- l->list_store = gtk_list_store_new (3, G_TYPE_STRING, G_TYPE_INT,
GDK_TYPE_PIXBUF);
- l->list_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL
(l->list_store));
- gtk_widget_set_name (l->list_view, "gtktreeview-black");
- gtk_widget_show (l->list_view);
- //l->mokolist_view = moko_tree_view_new_with_model (GTK_TREE_MODEL
(l->list_store));
- gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (l->list_view), FALSE);
- //gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (l->mokolist_view),
FALSE);
-
- /* l->renderer = gtk_cell_renderer_pixbuf_new ();
- l->column = gtk_tree_view_column_new_with_attributes ("Icon", l->renderer,
"pixbuf", 2, NULL);
- gtk_tree_view_append_column (GTK_TREE_VIEW (l->list_view), l->column);
- //moko_tree_view_append_column (GTK_TREE_VIEW (l->mokolist_view),
l->column);
-
- l->renderer = gtk_cell_renderer_text_new ();
- l->column = gtk_tree_view_column_new_with_attributes ("Running programs",
l->renderer,
-
"text", 0, NULL);
- gtk_tree_view_append_column (GTK_TREE_VIEW (l->list_view), l->column);
- */
-
- column = gtk_tree_view_column_new();
- gtk_tree_view_column_set_title (column, ("Task list"));
- gtk_tree_view_column_set_resizable (column, TRUE);
-
- renderer = gtk_cell_renderer_pixbuf_new ();
- gtk_tree_view_column_pack_start (column, renderer , FALSE);
- gtk_tree_view_column_set_attributes (column, renderer ,
- "pixbuf", PIXBUF_COL, NULL);
-
- renderer = gtk_cell_renderer_text_new ();
- gtk_tree_view_column_pack_start (column, renderer , FALSE);
- gtk_tree_view_column_set_attributes(column, renderer ,
- "text", TEXT_COL, NULL);
-
- gtk_tree_view_append_column (GTK_TREE_VIEW (l->list_view), column);
-
- l->scrolled = gtk_scrolled_window_new (NULL, NULL);
- gtk_widget_show (l->scrolled);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (l->scrolled),
- GTK_POLICY_NEVER, GTK_POLICY_NEVER);
- gtk_container_add (GTK_CONTAINER (align), l->list_view);
- gtk_container_add (GTK_CONTAINER (l->scrolled), align);
- gtk_widget_set_size_request (l->scrolled, -1, 400);
+ l->scrolled = gtk_scrolled_window_new (NULL, NULL);
+ gtk_widget_show (l->scrolled);
+ gtk_widget_set_size_request (GTK_WINDOW(l->scrolled), -1, 400);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (l->scrolled),
GTK_POLICY_NEVER, GTK_POLICY_NEVER);
+ gtk_container_add (GTK_CONTAINER (l->scrolled), l->list_view);
- //l->scrolled = moko_tree_view_put_into_scrolled_window (l->mokolist_view);
-
- //gtk_box_pack_start (GTK_BOX (l), l->hbox, FALSE, FALSE, 0);
- //gtk_box_pack_end (l->hbox, l->btn_close, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (l), l->scrolled, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (l), l->scrolled, TRUE, TRUE, 0);
- default_icon = gdk_pixbuf_new_from_file_at_size
(PKGDATADIR"/default-app-icon.xpm",
- 160, 160, NULL);
- if (!default_icon )
- g_error ("Failed to load default icon");
-}
+ default_icon = gdk_pixbuf_new_from_file_at_size
(PKGDATADIR"/default-app-icon.xpm", 140, 140, NULL);
+ if (!default_icon )
+ g_error ("Failed to load default icon");
+ g_signal_connect (l->list_view, "selection_changed", G_CALLBACK (
moko_task_list_selection_changed), l);
+}
/* Construction */
GtkWidget*
moko_task_list_new()
@@ -168,35 +135,36 @@
static void
moko_add_window (Display *dpy, Window w, GtkListStore *list_store)
{
- GtkTreeIter iter;
- gchar *name = NULL;
- GdkPixbuf *icon = NULL;
+ GtkTreeIter iter;
+ gchar *name = NULL;
+ GdkPixbuf *icon = NULL;
- name = moko_get_window_name(dpy, w);
- if (!strcmp (name, "Openmoko-taskmanager"))
- {
- g_free (name);
- return;
- }
+ name = moko_get_window_name(dpy, w);
+ if (!strcmp (name, "Openmoko-taskmanager"))
+ {
+ g_free (name);
+ return;
+ }
- icon = moko_get_window_icon (dpy, w);
- gtk_list_store_append (list_store, &iter);
- gtk_list_store_set (list_store, &iter, TEXT_COL, name, OBJECT_COL, w, -1);
+ icon = moko_get_window_icon (dpy, w);
+ gtk_list_store_append (list_store, &iter);
+ g_debug ("add widnow %s", name);
+ gtk_list_store_set (list_store, &iter, TEXT_COL, name, OBJECT_COL, w, -1);
- if (icon)
- {
- GdkPixbuf *icons = gdk_pixbuf_scale_simple (icon, 160, 160,
GDK_INTERP_BILINEAR);
- gtk_list_store_set (list_store, &iter, PIXBUF_COL, icons, -1);
- gdk_pixbuf_unref (icons);
- }
- else if (default_icon)
- gtk_list_store_set (list_store, &iter, PIXBUF_COL, default_icon, -1);
- else
- g_error ("Failed to load %s's icon", name);
-
- if (icon)
- gdk_pixbuf_unref (icon);
- g_free (name);
+ if (icon)
+ {
+ GdkPixbuf *icons = gdk_pixbuf_scale_simple (icon, 140, 140,
GDK_INTERP_BILINEAR);
+ gtk_list_store_set (list_store, &iter, PIXBUF_COL, icons, -1);
+ gdk_pixbuf_unref (icons);
+ }
+ else if (default_icon)
+ gtk_list_store_set (list_store, &iter, PIXBUF_COL, default_icon, -1);
+ else
+ g_warning ("Failed to load %s's icon", name);
+
+ if (icon)
+ gdk_pixbuf_unref (icon);
+ g_free (name);
}
void
@@ -211,14 +179,15 @@
return;
p = g_malloc0 (nr);
- if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (list_store), &iter))
{
+ if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (list_store), &iter))
+ {
gboolean more;
do{
gboolean found = FALSE;
Window w;
gtk_tree_model_get (GTK_TREE_MODEL (list_store), &iter, OBJECT_COL, &w,
-1);
for (i=0; i<nr; i++)
- {
+ {
if (list[i] == w)
{
p[i] = 1;
@@ -273,7 +242,7 @@
{
GtkTreePath *path;
path = gtk_tree_model_get_path (GTK_TREE_MODEL
(l->list_store), &iter);
- gtk_tree_view_set_cursor (GTK_TREE_VIEW
(l->list_view), path, NULL, FALSE);
+ gtk_icon_view_select_path (GTK_ICON_VIEW
(l->list_view), path);
gtk_tree_path_free (path);
break;
}
@@ -285,3 +254,27 @@
}
}
+static void
+moko_task_list_selection_changed (GtkIconView *self, MokoTaskList *l)
+{
+ char *name = NULL;
+ Window w;
+ GtkTreeIter iter;
+ GList *path = gtk_icon_view_get_selected_items (GTK_ICON_VIEW (self));
+ GtkTreeModel *model = gtk_icon_view_get_model (GTK_ICON_VIEW(self));
+
+ if ( !path)
+ return;
+
+ gtk_tree_model_get_iter (model, &iter, path->data);
+ gtk_tree_model_get (GTK_TREE_MODEL (l->list_store), &iter, OBJECT_COL, &w,
-1);
+ name = moko_get_window_name(GDK_DISPLAY(), w);
+
+ if (name)
+ moko_dbus_send_message (name);
+
+ g_list_foreach (path, gtk_tree_path_free, NULL);
+ g_list_free (path);
+ g_free (name);
+ return;
+}
Modified:
trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/list_view.h
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/list_view.h
2007-04-03 14:22:48 UTC (rev 1648)
+++ trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/list_view.h
2007-04-04 03:52:48 UTC (rev 1649)
@@ -28,13 +28,17 @@
#include "misc.h"
+#define COLUMN_NO 3
+#define COLUMN_SPACE 20
+#define ROW_SPACE 20
+#define MARGIN 10
+
enum{
TEXT_COL = 0,
OBJECT_COL,
PIXBUF_COL,
MAX_COL
};
-
G_BEGIN_DECLS
/*MOKOTASKLIST property*/
Modified:
trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/taskmanager.c
===================================================================
---
trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/taskmanager.c
2007-04-03 14:22:48 UTC (rev 1648)
+++
trunk/src/target/OM-2007/applications/openmoko-taskmanager/src/taskmanager.c
2007-04-04 03:52:48 UTC (rev 1649)
@@ -242,6 +242,8 @@
G_CALLBACK (moko_wheel_left_up_press_cb), tm);
g_signal_connect (tm->wheel, "press_right_down",
G_CALLBACK (moko_wheel_right_down_press_cb), tm);
+ g_signal_connect (tm->wheel, "press_bottom",
+ G_CALLBACK (moko_wheel_bottom_press_cb), tm);
gdk_window_add_filter (NULL, moko_window_filter, tm->l);
XSelectInput (dpy, DefaultRootWindow (dpy), PropertyChangeMask);
--- End Message ---