Re: How to make a button look like a treeview column title? [Was: How to use the treeview column title style for a button?]

2007-10-09 Thread Bastiaan Veelo
Kristian Rietveld wrote:
 On Mon, Oct 08, 2007 at 03:53:29PM +0200, Bastiaan Veelo wrote:
   
 Something like this seems to work for me:

   button = gtk_button_new_with_label (...);
   style = gtk_rc_get_style_by_paths (gtk_widget_get_settings (button),
  *.GtkTreeView.GtkButton,
  NULL,
  G_OBJECT_TYPE (button));
   gtk_widget_set_style (button, style);
   
snip
 I guess I need to trick the theme engine into thinking that it is 
 drawing a GtkTreeView button. Is there a way to do that? If the method 
 would be engine-dependent, I need it to work on MS Windows.
 

 That is exactly what the code above tries to achieve.
snip

The reason why this is not going to work (for the windows theme at 
least, GTK+ 2.10) is a hard-coded check on the type of widget-parent in 
draw_box() on line 1929 of msw_style.c:

if (GTK_IS_TREE_VIEW (widget-parent)
|| GTK_IS_CLIST (widget-parent))
{
if (xp_theme_draw
(window, XP_THEME_ELEMENT_LIST_HEADER, style, x, y,
 width, height, state_type, area))
return;


___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: How to make a button look like a treeview column title? [Was: How to use the treeview column title style for a button?]

2007-10-09 Thread Bastiaan Veelo
Bastiaan Veelo wrote:
 The reason why this is not going to work (for the windows theme at
 least, GTK+ 2.10) is a hard-coded check on the type of widget-parent in 
 draw_box() on line 1929 of msw_style.c:
   

So I faked the parent widget through some evil hacking in the expose 
function below. It works, for now.


#include gtk/gtk.h

G_BEGIN_DECLS

#define GTK_TYPE_HEADER (gtk_header_get_type ())
#define GTK_HEADER(obj) (G_TYPE_CHECK_INSTANCE_CAST 
((obj), GTK_TYPE_HEADER, GtkMenuSheet))
#define GTK_HEADER_CLASS(klass) G_TYPE_CHECK_CLASS_CAST ((klass, 
GTK_TYPE_HEADER, GtkMenuSheetClass))
#define GTK_IS_HEADER(obj)  (G_TYPE_CHECK_INSTANCE_TYPE 
((obj), GTK_TYPE_HEADER))
#define GTK_IS_HEADER_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE 
((klass), GTK_TYPE_HEADER))
#define GTK_HEADER_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS 
((obj), GTK_TYPE_HEADER, GtkMenuSheetClass))

typedef struct _GtkHeader   GtkHeader;
typedef struct _GtkHeaderClass  GtkHeaderClass;

struct _GtkHeader
{
  GtkButton parent;
};

struct _GtkHeaderClass
{
  GtkButtonClass parent_class;
};

G_END_DECLS

GTypegtk_header_get_type (void) G_GNUC_CONST;
GtkWidget   *gtk_header_sheet_new();
static gboolean  gtk_header_expose   (GtkWidget  
*widget,
  GdkEventExpose 
*event);

static void
gtk_header_class_init (GtkHeaderClass *class)
{
  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
  widget_class-expose_event = gtk_header_expose;
}

static void
gtk_header_init (GtkHeader *header)
{
}

/* GType Methods */

G_DEFINE_TYPE (GtkHeader, gtk_header, GTK_TYPE_BUTTON)

GType
gtk_header_type ()
{
  static GType header_type = 0;

  if (!header_type)
  {
static const GTypeInfo header_info =
{
  sizeof (GtkHeaderClass),
  NULL, /* base_init */
  NULL, /* base_finalize */
  (GClassInitFunc) gtk_header_class_init,
  NULL, /* class_finalize */
  NULL, /* class_data */
  sizeof (GtkHeader),
  0,/* n_preallocs */
  (GInstanceInitFunc) gtk_header_init,
};

header_type = g_type_register_static (GTK_TYPE_BUTTON,
  GtkHeader,
  header_info,
  0);
  }
  return header_type;
}

static gboolean
gtk_header_expose (GtkWidget  *widget,
   GdkEventExpose *event)
{
  static GtkWidget *treeview = NULL;
  if (!treeview) treeview = gtk_tree_view_new();

  /* Trick draw_box() in msw_style.c on line 1929 into thinking that our 
parent
 is a GtkTreeView. This works on MS Windows and GTK+ 2.10.6, but it may
 fail miserably when used with other themes or other versions of 
GTK+. */
  GtkWidget *real_parent = widget-parent;
  widget-parent = treeview;
  (* GTK_WIDGET_CLASS (gtk_header_parent_class)-expose_event) (widget, 
event);
  widget-parent = real_parent;

  return FALSE;
}

GtkWidget*
gtk_header_new (void)
{
  return g_object_new (GTK_TYPE_HEADER, NULL);
}

int main( int   argc,
  char *argv[] )
{
  gtk_init (argc, argv);

  GtkWidget *window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  g_signal_connect (window, destroy,
G_CALLBACK (gtk_widget_destroyed), window);

  GtkWidget *header = gtk_header_new();
  gtk_button_set_label (GTK_BUTTON (header), Header);
  /* Not sure whether the folowwing is necessary. */
  GtkStyle *style = gtk_rc_get_style_by_paths (gtk_widget_get_settings 
(header),
   NULL,
   *.GtkTreeView.GtkButton,
   GTK_TYPE_BUTTON);
  gtk_widget_set_style (header, style);
  gtk_container_add (GTK_CONTAINER (window), header);

  gtk_widget_show_all(window);
  gtk_main ();

  return 0;
}


___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: How to redraw the blanked section of a widget after a expose-event?

2007-10-09 Thread Arto Karppinen
krist misra wrote:
 Hi experts,

 I am using GTK+ and gstreamer to capture and show the video frames, I
 created a drawable widget using gtk_drawing_area_new() and using xvimage
 element of gstreamer to render the video, I also connected them by a
 gstreamer function gst_x_overlay_set_xwindow_id(), so the video frames
 rendered  by xvimage can show in the widget, now it works well.

 But I encounter a problem that if part of the drawable widget being covered
 by a menu or something, when the menu disappears, the covered section keeps
 blank, even other part of the widget still show the video.

 I try to write a function expose_cb() and connect it with the signal
 expose-event, in that function I call gst_x_overlay_set_xwindow_id()
 again and also gtk_widget_show_all(), but it seems still not work. cos it's
 showing a video so I cannot save some image and redraw it again
 after it exposes.

 Anyone can help me? how should I do in the expose_cb or something else?
 Thanks a lot
 below is part of the source code
 -
 static gboolean expose_cb(GtkWidget * widget, GdkEventExpose * event,
 gpointer data)
 {
 gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(data),
   GDK_WINDOW_XWINDOW(widget-window));
 gtk_widget_show_all(widget);
 }

 int main()
 {
 ...
   gstreamer_main_video_image = gtk_drawing_area_new();
 ...
   screen_sink = gst_bin_get_by_name (GST_BIN (appdata.bin), screensink);
 ...
   gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(screen_sink),
 GDK_WINDOW_XWINDOW(gstreamer_main_video_image-window));
g_signal_connect(gstreamer_main_video_image, expose-event,
 G_CALLBACK(expose_cb),
  screen_sink);
   gtk_widget_show_all(gstreamer_window);
 ...
 }
 
 Krist.
 ___
 gtk-app-devel-list mailing list
 gtk-app-devel-list@gnome.org
 http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

   
I dont know if this is a correct solution, but i have drawn images to 
the background of gtk_drawing_area, and if you do that, then GTK will 
keep the background pixmap around for redrawing purposes.

Use something like this:

gdk_window_set_back_pixmap(widget-window, pixmap, FALSE);
gtk_widget_queue_draw_area(widget, 0, 0,
   widget-allocation.width,
   widget-allocation.height);

And create a pixmap where you draw the images, and queue redraw when the 
you redraw the pixmap.

-- 
Arto Karppinen
--
[EMAIL PROTECTED]

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: timeout function not called

2007-10-09 Thread v_wishful
Thanks James,

Sorry, I didn't mean to seem like I was ignoring you, but the code I  
am working on is part of a bigger application and I wasn't sure how to  
extract the bit I was working on into a usable piece. I was also  
looking into using GIOChannels to see if I could make that work.

Thanks for the example. I'll work through it and see if I can get that  
working in my project.

Sincerely,

Vicki

Quoting James Scott Jr [EMAIL PROTECTED]:

 Vicki,
 Here is a more complete example of how to resolve your issue.
 Compile with this command
 '# gcc -Wall -g -O2 `pkg-config --libs --cflags gtk+-2.0 glib-2.0
 gthread-2.0` gprogress.c'



--
Invent your own San Diego at sandiego.com!


___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


GtkPageSetupUnixDialog and GtkPrintUnixDialog

2007-10-09 Thread Lance Dillon
GtkPageSetupUnixDialog and GtkPrintUnixDialog don't exist on my system, even 
though it seems that they should.

Fedora 7
gtk2-2.10.14-3.fc7
gtk2-devel-2.10.14-3.fc7

Documentation 
(http://library.gnome.org/devel/gtk/unstable/GtkPageSetupUnixDialog.html) shows 
it was added in gtk+ 2.10.

However, the header files dont exist.  They do exist in the source, though:

/home/riffraff/src/gtk+-2.10.14/gtk
[EMAIL PROTECTED] gtk]$ ls gtkprintunixdialog.*
gtkprintunixdialog.c  gtkprintunixdialog.h  gtkprintunixdialog.lo
[EMAIL PROTECTED] gtk]$ ls gtkpagesetupunixdialog.*
gtkpagesetupunixdialog.c  gtkpagesetupunixdialog.h  gtkpagesetupunixdialog.lo
[EMAIL PROTECTED] gtk]$ 

But:
[EMAIL PROTECTED] gtk]$ ls -al /usr/include/gtk-2.0/gtk/gtkpagesetup*
-rw-r--r-- 1 root root 3765 2007-07-24 22:38 
/usr/include/gtk-2.0/gtk/gtkpagesetup.h
[EMAIL PROTECTED] gtk]$ ls -al /usr/include/gtk-2.0/gtk/gtkprintun*
ls: cannot access /usr/include/gtk-2.0/gtk/gtkprintun*: No such file or 
directory
[EMAIL PROTECTED] gtk]$ 

So, is something wrong with my system?  With the packages provided by Fedora?  
Or is the documentation incorrect?

Thanks,
Lance





  

Fussy? Opinionated? Impossible to please? Perfect.  Join Yahoo!'s user panel 
and lay it on us. http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7 

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


glib delays using a monotonic timer

2007-10-09 Thread Cliff Brake
Is it possible to use a monotonic timer with glib delays -- for instance:

g_async_queue_timed_pop
g_timeout_add

If I change the system time (Linux date command) in between when I
call the above functions, and the timer is supposed to expire, the
timer gets messed up by the system time change.  What is the best
solution to this problem?

man clock_nanosleep gives lots of useful information about the
differences between the REALTIME, and MONOTONIC system timers.

Thanks,
Cliff

-- 
===
Cliff Brake
http://bec-systems.com
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: GtkPageSetupUnixDialog and GtkPrintUnixDialog

2007-10-09 Thread Yeti
On Tue, Oct 09, 2007 at 10:26:30AM -0700, Lance Dillon wrote:
 GtkPageSetupUnixDialog and GtkPrintUnixDialog don't exist on my system, even 
 though it seems that they should.

They do.

 Fedora 7
 gtk2-2.10.14-3.fc7
 gtk2-devel-2.10.14-3.fc7

  rpm -q gtk2-devel | grep unix

should clarify things a lot...

 ...

 So, is something wrong with my system?  With the packages provided by Fedora? 
  Or is the documentation incorrect?

The Gtk+ Unix printing stuff is in gtk+-unix-print-2.0
pkg-config package.  If you really need to use the
non-portable Unix part of the API, you have to add flags
from this package.

Yeti

--
http://gwyddion.net/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: GtkPageSetupUnixDialog and GtkPrintUnixDialog

2007-10-09 Thread Lance Dillon


- Original Message 
From: David Nečas (Yeti) [EMAIL PROTECTED]
To: gtk-app-devel-list@gnome.org
Sent: Tuesday, October 9, 2007 1:36:55 PM
Subject: Re: GtkPageSetupUnixDialog and GtkPrintUnixDialog

On Tue, Oct 09, 2007 at 10:26:30AM -0700, Lance Dillon wrote:
 GtkPageSetupUnixDialog and GtkPrintUnixDialog don't exist on my system, even 
 though it seems that they should.

They do.

 Fedora 7
 gtk2-2.10.14-3.fc7
 gtk2-devel-2.10.14-3.fc7

  rpm -q gtk2-devel | grep unix

should clarify things a lot...

 ...

 So, is something wrong with my system?  With the packages provided by Fedora? 
  Or is the documentation incorrect?

The Gtk+ Unix printing stuff is in gtk+-unix-print-2.0
pkg-config package.  If you really need to use the
non-portable Unix part of the API, you have to add flags
from this package.

Yeti


-

Okay, thanks for the help.  It doesn't appear that Fedora 7 doesn't provide 
these packages, at least not in the default repositories.






   

Take the Internet to Go: Yahoo!Go puts the Internet in your pocket: mail, news, 
photos  more. 
http://mobile.yahoo.com/go?refer=1GNXIC
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: GtkPageSetupUnixDialog and GtkPrintUnixDialog

2007-10-09 Thread Lance Dillon




WTF?

If the Fedora 7 packages

  gtk2-2.10.14-3.fc7
  gtk2-devel-2.10.14-3.fc7

*you* asked about are not provided by your Fedora 7, then at
least one of us is confused.

No, I meant the ones you referenced before:

 rpm -q gtk2-devel | grep unix


[EMAIL PROTECTED] ~]# yum list|grep gtk2-devel|grep unix
[EMAIL PROTECTED] ~]# 






  

Tonight's top picks. What will you watch tonight? Preview the hottest shows on 
Yahoo! TV.
http://tv.yahoo.com/ 

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: timeout function not called

2007-10-09 Thread JAMES SCOTT
Vicki,

I though you might have been chopping something up, thats the reason for the 
quick samepl.  I'm going to assume it worked for you and you understand why it 
works.  As for GIOChannels, they are very handy and could be used in an 
elaborate scheme to get this simple thing done.

James,
(This mailing list has an archive you can search for q/a on GIOChannels and 
ProgressBars...)


- Original Message 
From: [EMAIL PROTECTED] [EMAIL PROTECTED]
To: James Scott Jr [EMAIL PROTECTED]
Cc: gtk-app-devel-list@gnome.org
Sent: Tuesday, October 9, 2007 11:45:52 AM
Subject: Re: timeout function not called


Thanks James,

Sorry, I didn't mean to seem like I was ignoring you, but the code I  
am working on is part of a bigger application and I wasn't sure how to  
extract the bit I was working on into a usable piece. I was also  
looking into using GIOChannels to see if I could make that work.

Thanks for the example. I'll work through it and see if I can get that  
working in my project.

Sincerely,

Vicki

Quoting James Scott Jr [EMAIL PROTECTED]:

 Vicki,
 Here is a more complete example of how to resolve your issue.
 Compile with this command
 '# gcc -Wall -g -O2 `pkg-config --libs --cflags gtk+-2.0 glib-2.0
 gthread-2.0` gprogress.c'



--
Invent your own San Diego at sandiego.com!
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list