List Info

Thread: libwnck test-tasklist applet




libwnck test-tasklist applet
user name
2006-05-10 13:07:03
Hello List,

I'm playing with a simple desktop setup which has just
metacity and a
tasklist. 

This post relates to libwnck, rather than metacity, please
let me know
if there is a better list to post this to.

I've made some trivial changes to test-tasklist.c to make
it appear as a
dock-bar at the bottom of the screen. 

There are only two problems.

1) When there is only one task, then the task appears as a
button which
is the width of the whole window, rather than having a
reasonable
minimum button width.

2) If there are a number of tasks running, then the text
describing the
tasks will overflow over the end of the button.

These have been solved in the gnome window-list applet, but
I'm
wondering what the easiest way I could add these changes to
test-taskbar.c? 

What signals can I connect to when the number of items in
the taskbar
changes?

It seems as if I need to change the size of the containing
frame, when
the number of elements  in the tasklist is lower than some
number.

Any hints gratefully received.

best regards,

Seb James

Here's my modified version of test-tasklist.c:

-------------------test-tasklist.c--------------------------
------------
#include <libwnck/libwnck.h>
#include <gtk/gtk.h>

#define TASKLIST_HEIGHT 30

int
main (int argc, char **argv)
{
  WnckScreen *screen;
  GtkWidget *win;
  GtkWidget *frame;
  GtkWidget *tasklist;
  int w, h;
  int n_elements;
  int * size_hints;

  gtk_init (&argc, &argv);

  screen = wnck_screen_get_default ();
  w = wnck_screen_get_width (screen);
  h = wnck_screen_get_height (screen);
  
  /* because the pager doesn't respond to signals at the
moment */
  wnck_screen_force_update (screen);
  win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_default_size (GTK_WINDOW (win), w,
TASKLIST_HEIGHT);
  gtk_window_stick (GTK_WINDOW (win));
  wnck_gtk_window_set_dock_type (GTK_WINDOW (win));

  gtk_window_set_title (GTK_WINDOW (win), "Task
List");
  gtk_window_set_policy (GTK_WINDOW (win),
			 TRUE, TRUE, FALSE);

  /* quit on window close */
  g_signal_connect (G_OBJECT (win), "destroy",
                    G_CALLBACK (gtk_main_quit),
                    NULL);

  tasklist = wnck_tasklist_new (screen);
  wnck_tasklist_set_grouping (WNCK_TASKLIST (tasklist),
WNCK_TASKLIST_AUTO_GROUP);

  /* Wonder if size_hints is something to do with solution?
*/
  size_hints = wnck_tasklist_get_size_hint_list (tasklist,
&n_elements);
  g_print ("n elements = %d\n", n_elements);

  frame = gtk_frame_new (NULL);
  gtk_frame_set_shadow_type (GTK_FRAME (frame),
GTK_SHADOW_OUT);
  gtk_container_add (GTK_CONTAINER (win), frame);

  gtk_container_add (GTK_CONTAINER (frame), tasklist);  

  gtk_widget_show (tasklist);
  gtk_widget_show (frame);

  gtk_window_move (GTK_WINDOW (win), 0, h-TASKLIST_HEIGHT);
  
  gtk_widget_show (win);
  
  gtk_main ();
  
  return 0;
}
------------------------------------------------------------

-- 
Embedded Software Foundry Ltd. 'Embedded Linux
Development'
Tel: +44 (0)845 4580277   Web: http://www.esfnet.co.uk/
Axiom Tech Open Source Member: http://www.axiomtech.co.u
k/
Gpg key: http://www.esfnet
.co.uk/ssl/seb.gpg

_______________________________________________
metacity-devel-list mailing list
metacity-devel-listgnome.org
http://mail.gnome.org/mailman/listinfo/metacity-devel-
list
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )