how to hide popup window ?

2007-11-22 Thread sphurti durgade
Hi
i am creating one pop-up window witch contains one widget in my main 
application window .

i am showing this pop-up window on one button press  event (in callback of 
button ) at current mouse position 
Now i want to hide this window when i press any other widget on window 
including main 
application window 

witch signal should i connect ( may be to main window ? ) so that single click 
on any widget 
(including main application window)  will hide my pop up window  
in its callback function (i will write gtk_widget_hide_all(popup_window) as a 
function definition of it)

Thanks in advanced
sphurti





  Why delete messages? Unlimited storage is just a click away. Go to 
http://help.yahoo.com/l/in/yahoo/mail/yahoomail/tools/tools-08.html
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Insert gap in text buffer by using a tag

2007-11-22 Thread Miroslav Rajcic
I am having a text like "0bullet" inside of GtkTextView, where the first 
character is a bullet sign and the rest is the ordinary text
I need to be able to format this text to insert some space gap between the 
bullet and the rest (should look like this: "0   bullet").

I've tried using tags in 3 different ways but none of these seem to work:

a) using "indent" property:

GtkTextTag *tag1 = gtk_text_buffer_create_tag (buffer, NULL,"indent", 
18,"indent-set", TRUE,NULL);
gtk_text_buffer_apply_tag(buffer, tag1, &iterBulletEnd, &iterEnd);

b) using "left-margin" property:

GtkTextTag *tag1 = gtk_text_buffer_create_tag (buffer, NULL,"left-margin", 
18,"left-margin-set", TRUE,NULL);
gtk_text_buffer_apply_tag(buffer, tag1, &iterBulletEnd, &iterEnd);

c) using "right-margin" property:

GtkTextTag *tag1 = gtk_text_buffer_create_tag (buffer, NULL, "right-margin", 
18, "right-margin-set", TRUE, NULL);
gtk_text_buffer_apply_tag(buffer, tag1, &iterStart, &iterBulletEnd);

where iterStart points to the start of text, iterEnd points to the end of 
text, iterBulletEnd points after the bullet sign.

Does anyone has an idea what is wrong here ?

Regards,
  Miroslav

PS. Entire sample below, uncomment "#if 0" blocks to try

#include 
void create_window();
void insert_bulleted_line();
GtkTextBuffer *buffer;
int main (int argc, char *argv[])
{
gtk_init (&argc, &argv);
create_window();
insert_bulleted_line();
gtk_main ();
return 0;
}

void create_window()
{
GtkWidget *window1;
GtkWidget *scrolledwindow2;
GtkWidget *textview1;
window1 = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window1), "test");
gtk_widget_show (window1);
scrolledwindow2 = gtk_scrolled_window_new (NULL, NULL);
gtk_widget_show (scrolledwindow2);
gtk_container_add (GTK_CONTAINER (window1), scrolledwindow2);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow2), 
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
buffer = gtk_text_buffer_new (NULL);
textview1 = gtk_text_view_new_with_buffer (buffer);
gtk_widget_show (textview1);
gtk_container_add (GTK_CONTAINER (scrolledwindow2), textview1);
}
void insert_bulleted_line()
{
//insert text
GtkTextIter iterStart;
gtk_text_buffer_get_start_iter (buffer, &iterStart);
gtk_text_buffer_insert(buffer, &iterStart, "obullet", -1);

// refresh iterator
gtk_text_buffer_get_start_iter (buffer, &iterStart);

GtkTextIter iterEnd;
gtk_text_buffer_get_end_iter (buffer, &iterEnd);

//
// formatting
//
#if 0
//indent entire bullet line - this works OK
GtkTextTag *tag = gtk_text_buffer_create_tag (buffer, NULL, "left-margin", 
18, "left-margin-set", TRUE, NULL);
gtk_text_buffer_apply_tag(buffer, tag, &iterStart, &iterEnd);
#endif

// try to create a gap between the fist character (bullet) and the rest of 
the line
GtkTextIter iterBulletEnd = iterStart;
gtk_text_iter_forward_char (&iterBulletEnd);
int nOffset = gtk_text_iter_get_offset(&iterBulletEnd);

#if 1
GtkTextTag *tag1 = gtk_text_buffer_create_tag (buffer, NULL, "indent", 18, 
"indent-set", TRUE, NULL);
gtk_text_buffer_apply_tag(buffer, tag1, &iterBulletEnd, &iterEnd);
#endif

#if 0
GtkTextTag *tag1 = gtk_text_buffer_create_tag (buffer, NULL, "left-margin", 
18, "left-margin-set", TRUE, NULL);
gtk_text_buffer_apply_tag(buffer, tag1, &iterBulletEnd, &iterEnd);
#endif

#if 0
GtkTextTag *tag1 = gtk_text_buffer_create_tag (buffer, NULL, "right-margin", 
18, "right-margin-set", TRUE, NULL);
gtk_text_buffer_apply_tag(buffer, tag1, &iterStart, &iterBulletEnd);
#endif
} 

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


Re: memory leak in gtk

2007-11-22 Thread Tor Lillqvist
> > I have used mtrace to check for memory leaks. In this simple
> > application there are more than 5000 memory allocation which is not
> > freed.

Note that just a dynamic memory allocation that isn't freed before the
application terminates is not a leak, in case there still exists a way
to access that allocation through static variables (or variables local
to main()). You wouldn't call a "static int[1]" a leak, would you?
Nor should you then consider a "static int *p; main (void) { p =
malloc(1); return 0;}" a leak.

A leak, by definition, is an allocation that is done repeatedly while
the program is running, maybe while the user is performing some
repetitive task in the application, and to which no accessible pointer
remains. For an allocation to be classified as a leak the allocation
should be performed again and again from the same point in code, in a
similar context, and forgotten. All this IMHO, of course.

--tml
___
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 use icon_view in older version of gtk

2007-11-22 Thread Emmanuele Bassi

On Thu, 2007-11-22 at 14:50 +0530, Naveen Kumar wrote:
> Hi all,
> 
> I have one problem :  I saw an application in Gtk+-2.10.6 (icon-view in
> gtk-demo ),
> and i need to compile it using lower version of gtk (gtk+2.2.0).
> I tried compiling it but i am getting errors like :

GtkIconView is available since gtk+ 2.6. you cannot hope to use it with
a previous release of gtk+. upgrade gtk+: 2.2 was released many years
ago and it's not maintained; the latest stable (and maintained) release
of gtk+ is 2.12.1

ciao,
 Emmanuele.

-- 
Emmanuele Bassi,
W: http://www.emmanuelebassi.net
B: http://log.emmanuelebassi.net

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


How to use icon_view in older version of gtk

2007-11-22 Thread Naveen Kumar
Hi all,

I have one problem :  I saw an application in Gtk+-2.10.6 (icon-view in
gtk-demo ),
and i need to compile it using lower version of gtk (gtk+2.2.0).
I tried compiling it but i am getting errors like :

--
-- iconview.c: In function `main':
iconview.c:323: warning: assignment makes pointer from integer without a
cast
/tmp/ccuYVl91.o(.text+0x7db): In function `main':
: undefined reference to `gtk_icon_view_new_with_model'
/tmp/ccuYVl91.o(.text+0x7ee): In function `main':
: undefined reference to `GTK_ICON_VIEW'
/tmp/ccuYVl91.o(.text+0x7f7): In function `main':
: undefined reference to `gtk_icon_view_set_selection_mode'
/tmp/ccuYVl91.o(.text+0x856): In function `main':
: undefined reference to `GTK_ICON_VIEW'
/tmp/ccuYVl91.o(.text+0x85f): In function `main':
: undefined reference to `gtk_icon_view_set_text_column'
/tmp/ccuYVl91.o(.text+0x86f): In function `main':
: undefined reference to `GTK_ICON_VIEW'
/tmp/ccuYVl91.o(.text+0x878): In function `main':
: undefined reference to `gtk_icon_view_set_pixbuf_column'
collect2: ld returned 1 exit status
---

Is there any possibility to make use of the library(2.10.6)  files
which will actually give specific the specific functionality
(ex : gtk_icon_view_set_pixbuf_column')

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


GtkFileChooser initial dir

2007-11-22 Thread [EMAIL PROTECTED]
Hi,
could you point me to some useful documentation or suggest me 
something about:

1. storing and retrieving the initial opening/saving directory for a 
GtkFileChooser; in the past I relied on the windows registry, but I'd 
like to do something more GTK styled (a configuration file?)
2. retrieving the shortcuts names for "places"; I tried this way (and 
another that I don't recall) but it didn't work:

dialog = gtk_file_chooser_dialog_new(title, parent, action, 

GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,

GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
NULL);

GSList* shortcut_folders = gtk_file_chooser_list_shortcut_folders
(GTK_FILE_CHOOSER(dialog));
GSList* rover = shortcut_folders;
while(rover) {
  gchar *temp = (gchar *) rover->data;

  // I'd like to strcmp with a known "Place" shortcut but
  // temp is NULL here

  g_free (temp);
  rover = rover->next;
}

3. is it possible to change a "volume" shortcut label, or avoid its 
translation? For example Desktop is translated (in Italian, in my case) 
but many dummy users are lost if they see "Scrivania" instead of 
"Desktop"
Thanks a lot

Federico




Tiscali Voce 8 Mega (Telefono+Adsl). Attiva entro il 22/11/07: chiami in tutta 
Italia e navighi SENZA LIMITI A SOLI 4,95€ AL MESE FINO AL 31/03/2008! 
Dal 1° aprile 2008 paghi 28,95 € al mese.
http://abbonati.tiscali.it/telefono-adsl/prodotti/tc/voce8mega/

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