Help with closing a notebook page (GTK2)

2011-07-02 Thread Neil Munro
Hi, I have used pygtk before so I am familiar with some of the basic
concepts of gtk, but this is my first attempt with an actual gtk+ C
application and I have run into a few issues.

I have a notebook that I wish to have a close button on the page tabs
that when clicked closes the tabs.

I know that it's a bit off a faf to do as you don't know the page
prior to the event. So you have to dynamically detect which tab is
being closed by using a tab child widget.

Now I believe I have done this in code, except it always returns -1
which then firmly tells me I have done something wrong.

I have attached the code for your reference in the hopes that someone
shall be able to point out my no doubt simple mistake.

Many thanks in advance,
Neil Munro
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: Help with closing a notebook page (GTK2)

2011-07-03 Thread Neil Munro
On 3 July 2011 01:25, Bill C  wrote:
> On 03/07/11 07:40, Neil Munro wrote:
>>
>> Hi, I have used pygtk before so I am familiar with some of the basic
>> concepts of gtk, but this is my first attempt with an actual gtk+ C
>> application and I have run into a few issues.
>>
>> I have a notebook that I wish to have a close button on the page tabs
>> that when clicked closes the tabs.
>>
>> I know that it's a bit off a faf to do as you don't know the page
>> prior to the event. So you have to dynamically detect which tab is
>> being closed by using a tab child widget.
>>
>> Now I believe I have done this in code, except it always returns -1
>> which then firmly tells me I have done something wrong.
>>
>> I have attached the code for your reference in the hopes that someone
>> shall be able to point out my no doubt simple mistake.
>>
>> Many thanks in advance,
>> Neil Munro
>>
>>
>> ___
>> gtk-app-devel-list mailing list
>> gtk-app-devel-list@gnome.org
>> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>
> I use the switch page signal to keep track of the displayed page, put a
> button in the label of the page tab when I create it and delete the page
> when it is clicked.
>
> All works without problems.  Not even sure if I need to keep track of the
> displayed page...  May just be a hangover from development
>
> If you are doing this, then check your code again
>
> Rgds Bill
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>

What if I, or more importantly another user, opt to close a tab that
isn't currently selected? The current tab will be closed instead of
the button they clicked, or have I misunderstood you?
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: Help with closing a notebook page (GTK2)

2011-07-03 Thread Neil Munro
On 3 July 2011 19:31, Thomas  Bollmeier  wrote:
>>Ursprüngliche Nachricht-
>>Von: "Neil Munro" 
>>Gesendet: 02.07.2011 23:40:02
>>An: gtk-app-devel-list@gnome.org
>>Betreff: Help with closing a notebook page (GTK2)
>>
>>Hi, I have used pygtk before so I am familiar with some of the basic
>>concepts of gtk, but this is my first attempt with an actual gtk+ C
>>application and I have run into a few issues.
>>
>>I have a notebook that I wish to have a close button on the page tabs
>>that when clicked closes the tabs.
>>
>>I know that it's a bit off a faf to do as you don't know the page
>>prior to the event. So you have to dynamically detect which tab is
>>being closed by using a tab child widget.
>>
>>Now I believe I have done this in code, except it always returns -1
>>which then firmly tells me I have done something wrong.
>>
>>I have attached the code for your reference in the hopes that someone
>>shall be able to point out my no doubt simple mistake.
>>
>>Many thanks in advance,
>>Neil Munro
>
> I faced a similar problem when I wrote an editor for the first version of my 
> gobjectcreator tool some time ago. It was
> implemented in PyGTK - nevertheless it should work in C as well. The solution 
> may not be elegant but it
> worked:
> I registered a handler for the "clicked"-signal of the close button within 
> the tab label widget (a GtkHBox).
> Within the handler implementation I looped over all pages of the notebook and 
> checked whether the button instance
> in the page label was identical to the sender instance of the 
> "clicked"-signal. If yes then I had to remove the
> corresponding page.
> You can find the code example here:
>
> https://github.com/ThomasBollmeier/GObjectCreator/blob/master/gobject_creator/ui/documents_view.py
>
> (see lines 342ff. and 378ff. respectively)
>
> Hope that helps.
>
> Regards,
> Thomas
>
>
>
> ___
> Schon gehört? WEB.DE hat einen genialen Phishing-Filter in die
> Toolbar eingebaut! http://produkte.web.de/go/toolbar
>

Thanks to this and Bills suggestion the correct page closes, but I
need to determine a way to re-calculate the page as soon as a tab is
closed, am sure I will figure something out, but thanks for the
patience and help!
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: Help with closing a notebook page (GTK2)

2011-07-05 Thread Neil Munro
On 4 July 2011 15:02, walter tallent  wrote:
> Hi.
> I know I'm coming late to this party, but if you're packing the button  into 
> the
> tab, it's a child of that notebook page.  Can't you retrieve  the page you're 
> on
> by simply calling gtk_notebook_page_num () with the  button passed in as the
> child during the button's clicked signal  handler?  Then you pass the returned
> page number to  gtk_notebook_remove_page ().  This way you'll always remove 
> the
> correct  page, and it doesn't matter if the user brings that page to the front
> first or not.
>
> Or is there something I've overlooked?
> walter
>
>
>
> 
> From: Bill C 
> To: gtk-app-devel-list@gnome.org
> Sent: Sun, July 3, 2011 3:54:13 PM
> Subject: Re: Help with closing a notebook page (GTK2)
>
> On 04/07/11 06:26, Neil Munro wrote:
>> On 3 July 2011 19:31, Thomas  Bollmeier  wrote:
>>>> Ursprüngliche Nachricht-
>>>> Von: "Neil Munro"
>>>> Gesendet: 02.07.2011 23:40:02
>>>> An: gtk-app-devel-list@gnome.org
>>>> Betreff: Help with closing a notebook page (GTK2)
>>>>
>>>> Hi, I have used pygtk before so I am familiar with some of the basic
>>>> concepts of gtk, but this is my first attempt with an actual gtk+ C
>>>> application and I have run into a few issues.
>>>>
>>>> I have a notebook that I wish to have a close button on the page tabs
>>>> that when clicked closes the tabs.
>>>>
>>>> I know that it's a bit off a faf to do as you don't know the page
>>>> prior to the event. So you have to dynamically detect which tab is
>>>> being closed by using a tab child widget.
>>>>
>>>> Now I believe I have done this in code, except it always returns -1
>>>> which then firmly tells me I have done something wrong.
>>>>
>>>> I have attached the code for your reference in the hopes that someone
>>>> shall be able to point out my no doubt simple mistake.
>>>>
>>>> Many thanks in advance,
>>>> Neil Munro
>>> I faced a similar problem when I wrote an editor for the first version of my
>>>gobjectcreator tool some time ago. It was
>>> implemented in PyGTK - nevertheless it should work in C as well. The 
>>> solution
>>>may not be elegant but it
>>> worked:
>>> I registered a handler for the "clicked"-signal of the close button within 
>>> the
>>>tab label widget (a GtkHBox).
>>> Within the handler implementation I looped over all pages of the notebook 
>>> and
>>>checked whether the button instance
>>> in the page label was identical to the sender instance of the 
>>> "clicked"-signal.
>>>If yes then I had to remove the
>>> corresponding page.
>>> You can find the code example here:
>>>
>>>https://github.com/ThomasBollmeier/GObjectCreator/blob/master/gobject_creator/ui/documents_view.py
>>>y
>>>
>>> (see lines 342ff. and 378ff. respectively)
>>>
>>> Hope that helps.
>>>
>>> Regards,
>>> Thomas
>>>
>>>
>>>
>>> ___
>>> Schon gehört? WEB.DE hat einen genialen Phishing-Filter in die
>>> Toolbar eingebaut! http://produkte.web.de/go/toolbar
>>>
>> Thanks to this and Bills suggestion the correct page closes, but I
>> need to determine a way to re-calculate the page as soon as a tab is
>> closed, am sure I will figure something out, but thanks for the
>> patience and help!
>> ___
>> gtk-app-devel-list mailing list
>> gtk-app-devel-list@gnome.org
>> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
> Hi Neil
>
> Yes the page numbers can change when a page is closed, so you cant use
> original page numbers directly to switch pages.
>
> I think I redesigned so that I did not use page numbers. Let the user
> switch pages and process the page the user is working with.  Ensure the
> user cant delete pages that are prior to a page you want to reference
> directly.  As Thomas said...  Not totally elegant.
>
> Rgds Bill
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
> ___
> gtk-app-devel-list mailing li

Searching a gtk text view

2011-07-21 Thread Neil Munro
Hi all
I am trying to search a text view and I think I understand the
theory but I can't seem to get my code working in practice. What I
have come to understand is that I create a textmark object and try to
search for the presence of the text mark in the buffer, if it's found
then create an iter at the position of the text mark. From there
search the document for the presence of the search string, if it is
found and the text mark can't be found in the document create the text
mark and highlight the search string.

My program seg faults with the following error:
(X2:32030): Gtk-WARNING **: Invalid text buffer iterator: either the
iterator is uninitialized, or the characters/pixbufs/widgets in the
buffer have been modified since the iterator was created.
You must use marks, character numbers, or line numbers to preserve a
position across buffer modifications.
You can apply tags and insert marks without invalidating your iterators,
but any mutation that affects 'indexable' buffer contents (contents
that can be referred to by character offset)
will invalidate all outstanding iterators

If someone could help me I would be very appreciative.
Neil Munro


static void Search( GtkWidget *widget, struct node *tmp )
{
gchar *search;
search = gtk_entry_get_text( GTK_ENTRY( tmp->Search1 ) );
gboolean found;
GtkTextMark *last_pos;
GtkTextIter start, end;

last_pos = gtk_text_buffer_get_mark( GTK_TEXT_BUFFER( tmp->Buffer ),
"last_pos" );

if( last_pos )
gtk_text_buffer_get_iter_at_mark( GTK_TEXT_BUFFER( tmp->Buffer 
),
&tmp->iter, last_pos );

found = gtk_text_iter_forward_search( &tmp->iter, search, 0, &start,
&end, NULL );

if( found )
{   
if( last_pos == NULL )
gtk_text_buffer_create_mark( GTK_TEXT_BUFFER( 
tmp->Buffer ),
"last_pos", &end, FALSE );

gtk_text_buffer_select_range( GTK_TEXT_BUFFER( tmp->Buffer ),
&tmp->iter, &end );
}
}
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


VTE help

2011-07-29 Thread Neil Munro
I have been struggling to find examples and documentation on the vte
library for C. I have found a small example here
http://www.gtkforums.com/viewtopic.php?f=3&t=3304&hilit=vte but I am
still struggling for help since that example uses a deprecated call
fork_command call which should be fork_command_full, but I am not
really sure how to use the new function, since it requires vteptyflags
which I can find even fewer examples and documentation on.

Can someone help me get my terminal working with the new function call?

My code can be found here: https://gitorious.org/x2

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


Notebooks and GLists

2011-08-30 Thread Neil Munro
Hi folks
   Not a very descript title, but I fail to come up with a better
one. Anyway my problem is as follows.

I have a notebook with reorderable tabs which each displays a sourceview
widget.
Each sourceview widget represents a document where a document is an instance
of an object/struct.
When the tabs are re-ordered the glist becomes out of order with the tabs
and needs to be updated to reflect the new page positions.

Using the page-reordered signal and callback I can get the new page position
but not the old position.

If there is a better way to go about implementing a system like this, I
would be willing to hear it and any help is appreciated.

Finally you can get the code here: https://gitorious.org/x2

The file layout should be rather obvious.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Notebooks and GLists

2011-08-31 Thread Neil Munro
I figured I would need a separate glist, I can get the last know order from
the order of the original glist.

When I get the reorder signal it appears to be run after the reorder event
has taken place. So I see the need for a unique id. I assume this is where
g_object_set_data comes in?

How would I use such an id system though?

Also sorry if this top posts its being composed on my phone, I don't know
how it copes yet.
On 30 Aug 2011 23:49, "Michal Suchanek"  wrote:
> On 30 August 2011 23:08, Neil Munro  wrote:
>> Hi folks
>>   Not a very descript title, but I fail to come up with a better
>> one. Anyway my problem is as follows.
>>
>> I have a notebook with reorderable tabs which each displays a sourceview
>> widget.
>> Each sourceview widget represents a document where a document is an
instance
>> of an object/struct.
>> When the tabs are re-ordered the glist becomes out of order with the tabs
>> and needs to be updated to reflect the new page positions.
>>
>> Using the page-reordered signal and callback I can get the new page
position
>> but not the old position.
>>
>> If there is a better way to go about implementing a system like this, I
>> would be willing to hear it and any help is appreciated.
>>
>> Finally you can get the code here: https://gitorious.org/x2
>
> You did not implement any Reorder. In absence of any code to comment
> on I suggest you save the old order (= the last order known to your
> code) in another GList and when you receive a reorder event you can
> compare the new position with the saved position.
>
> You need these two GLists to hold the same (or convertible) unique
> values. eg. pointer to tab is one sufficiently unique value.
>
> Pointer to tab and pointer a struct containing a pointer to tab is an
> example of trivially convertible (and often very useful) unique
> values.
>
> HTH
>
> Michal
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


glib and relative file names

2011-10-08 Thread Neil Munro
Hey guys
  I am trying to work out a system to pass files to the
application I am working on, now it can accept absolute paths but it doesn't
seem to like relative paths can someone have a look at my code and see why
the G_FILE_TEST_EXISTS check fails? I have tried making the argument and
converting it to an absolute path by getting the output of g_get_current_dir
() which I understand to return the current working directory, but it only
returns the name of my home directory, which is unusual. Can someone shed
some light on this?

The code I am using is below.

if( argc == 1 ) // If no arguments were passed
gtk_window_set_focus( GTK_WINDOW( window ), New( NULL, Notebook ) );
else // Check to see if any files were specified on the cmd line
{
gint i;
for( i = 1; i < argc; i++ )
{
g_print( "\n%s\n", argv[ i ] );
if( g_file_test( argv[ i ], G_FILE_TEST_EXISTS ) )
{
g_print( "File exists!\n" );
gtk_window_set_focus( GTK_WINDOW( window ), open_with( argv[ i ], Notebook )
);
}
}
if( gtk_notebook_get_n_pages( GTK_NOTEBOOK( Notebook ) ) == 0 )
gtk_window_set_focus( GTK_WINDOW( window ), New( NULL, Notebook ) );
}
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Keybindings

2011-10-16 Thread Neil Munro
Hi all
   I want to simply press a keybinding and run a function that shows
hidden widgets is this possible and if so, how? It strikes me as something
not too difficult, but I am a self taught C programmer so I may simply not
know what such a thing would be called. I have already used an accelerator
group to work with widgets on screen, but what I want to do here has no
widget to click or whatever to show these.

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


Re: glib and relative file names

2011-10-16 Thread Neil Munro
Yeah I solved this, the problem was the programs current directory which I
have now fixed. Thanks anyway.

On 16 October 2011 14:52, Ardhan Madras  wrote:

> > I have tried making the argument and
> > converting it to an absolute path by getting the output of
> g_get_current_dir
> > () which I understand to return the current working directory but it
> > only returns the name of my home directory, which is unusual
>
> Why did you manage to build the file path with g_get_current_dir(),
> the result of course is depend on current directory of your program
> process that likely to be wrong. g_get_current_dir() return your
> home directory path most likely because you invoke your program
> from there.
>
>Ardhan
>
>
> --- neilmu...@gmail.com wrote:
>
> From: Neil Munro 
> To: gtk-app-devel-list@gnome.org
> Subject: glib and relative file names
> Date: Sat, 8 Oct 2011 19:54:13 +0100
>
> Hey guys
>  I am trying to work out a system to pass files to the
> application I am working on, now it can accept absolute paths but it
> doesn't
> seem to like relative paths can someone have a look at my code and see why
> the G_FILE_TEST_EXISTS check fails? I have tried making the argument and
> converting it to an absolute path by getting the output of
> g_get_current_dir
> () which I understand to return the current working directory, but it only
> returns the name of my home directory, which is unusual. Can someone shed
> some light on this?
>
> The code I am using is below.
>
> if( argc == 1 ) // If no arguments were passed
> gtk_window_set_focus( GTK_WINDOW( window ), New( NULL, Notebook ) );
> else // Check to see if any files were specified on the cmd line
> {
> gint i;
> for( i = 1; i < argc; i++ )
> {
> g_print( "\n%s\n", argv[ i ] );
> if( g_file_test( argv[ i ], G_FILE_TEST_EXISTS ) )
> {
> g_print( "File exists!\n" );
> gtk_window_set_focus( GTK_WINDOW( window ), open_with( argv[ i ], Notebook
> )
> );
> }
> }
> if( gtk_notebook_get_n_pages( GTK_NOTEBOOK( Notebook ) ) == 0 )
> gtk_window_set_focus( GTK_WINDOW( window ), New( NULL, Notebook ) );
> }
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>
>
>
>
> _
> Listen to KNAC, Hit the Home page and Tune In Live! --->
> http://www.knac.com
>
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Keybindings

2011-10-17 Thread Neil Munro
On 17 October 2011 15:54, Dong Luo  wrote:

> Hi,
>
> I did not use gtk recently. But I figure you can just let the toplevel
> widget response to the signal of key-press-event and do what ever
> Keybindings you want there.
>
> Dong
>

Could you show me an example as I have figured out the key-press-event is
the key here, but I can't seem to figure it out yet. Do I set up a
signal_connect from the window or something?


>
> ------
> *From:* Neil Munro 
> *To:* gtk-app-devel-list@gnome.org
> *Sent:* Sunday, October 16, 2011 6:55 AM
> *Subject:* Keybindings
>
> Hi all
>   I want to simply press a keybinding and run a function that shows
> hidden widgets is this possible and if so, how? It strikes me as something
> not too difficult, but I am a self taught C programmer so I may simply not
> know what such a thing would be called. I have already used an accelerator
> group to work with widgets on screen, but what I want to do here has no
> widget to click or whatever to show these.
>
> Thanks,
> Neil Munro
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>
>
>
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Keybindings

2011-10-18 Thread Neil Munro
Thanks, that's gotten me on the right track now.

Neil

On 18 October 2011 17:04, Dong Luo  wrote:

> Please check references for gtk and gdk. I just did that and came with a
> simple example showing the keyBindings. Please note that it's not tested as
> I currently don't have gtk installed on my machine.
>
> static gboolean keyBindings( GtkWidget *widget,
>   GdkEvent  *event,
>   gpointer   data )
> {
> GtkWidget *popup;
>
> if (event->type != GDK_KEY_PRESS) return FALSE;
>
> // here crtl-x will popup a new window
> if (((GdkEventKey)event->keyval == GDK_x) &&
> ((GdkEventKey)event->state & GDK_CONTROL_MASK)) {
> popup = gtk_window_new(GTK_WINDOW_POPUP);
> gtk_widget_show (window);
> }
> // more keyBindings can be checked
>
> return TRUE;
> }
>
> int main( int   argc,
>   char *argv[] )
> {
> GtkWidget *window;
>
> gtk_init (&argc, &argv);
>
> window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
>
> g_signal_connect (window, "key_press_event", G_CALLBACK (keyBindings),
> NULL);
>
> gtk_widget_show (window);
> gtk_main();
> return 0;
> }
>
> Dong
>
> --
> *From:* Neil Munro 
> *To:* gtk-app-devel-list@gnome.org
> *Sent:* Monday, October 17, 2011 11:43 AM
> *Subject:* Re: Keybindings
>
>
>
> On 17 October 2011 15:54, Dong Luo  wrote:
>
> Hi,
>
> I did not use gtk recently. But I figure you can just let the toplevel
> widget response to the signal of key-press-event and do what ever
> Keybindings you want there.
>
> Dong
>
>
> Could you show me an example as I have figured out the key-press-event is
> the key here, but I can't seem to figure it out yet. Do I set up a
> signal_connect from the window or something?
>
>
>
> --
> *From:* Neil Munro 
> *To:* gtk-app-devel-list@gnome.org
> *Sent:* Sunday, October 16, 2011 6:55 AM
> *Subject:* Keybindings
>
> Hi all
>   I want to simply press a keybinding and run a function that shows
> hidden widgets is this possible and if so, how? It strikes me as something
> not too difficult, but I am a self taught C programmer so I may simply not
> know what such a thing would be called. I have already used an accelerator
> group to work with widgets on screen, but what I want to do here has no
> widget to click or whatever to show these.
>
> Thanks,
> Neil Munro
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>
>
>
>
>
>
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Real time removal of toolitem

2012-01-14 Thread Neil Munro
Hey
  I was wondering if it is possible to remove a tool item from a
toolbar instantly, I am working with some preferences on my app and
want to have the preference changes displayed instantly, I have tried
to destroy the widget but it still works, am I missing something or is
it just not supported?

I don't see why it's not supported as a toolitem is a widget and
should be destroyed like all other widgets and I have tried the while(
gtk_pending_events( ) )... trick and that's not worked so does anyone
have any ideas?

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


Re: Real time removal of toolitem

2012-01-14 Thread Neil Munro
Strange, I don't know why perhaps I had a typo I missed but it's
working now with a simple show/hide:

// Deal with terminal now, since it would just waste cpu cycles
dealing with it in a for loop
if( g_strrstr( sets->terminal, ":false" ) )
gtk_widget_hide( GTK_WIDGET( pd->tb_cmd ) );

else
gtk_widget_show( GTK_WIDGET( pd->tb_cmd ) );

Thanks though.

2012/1/14 David Nečas :
> On Sat, Jan 14, 2012 at 12:34:10PM +, Neil Munro wrote:
>>       I was wondering if it is possible to remove a tool item from a
>> toolbar instantly,
>
> =
> from gi.repository import Gtk
>
> def modify(b, t):
>    if t.get_n_items() == 1:
>        b.set_stock_id(Gtk.STOCK_REMOVE)
>        b2 = Gtk.ToolButton.new_from_stock(Gtk.STOCK_HELP)
>        b2.show_all()
>        t.insert(b2, 1)
>    else:
>        b.set_stock_id(Gtk.STOCK_ADD)
>        t.get_nth_item(1).destroy()
>    print t.get_n_items()
>
> w = Gtk.Window()
> w.connect('destroy', Gtk.main_quit)
> w.set_default_size(200,40)
>
> t = Gtk.Toolbar()
> w.add(t)
>
> b = Gtk.ToolButton.new_from_stock(Gtk.STOCK_ADD)
> b.connect('clicked', modify, t)
> t.insert(b, 0)
>
> w.show_all()
> Gtk.main()
> =
>
>> I have tried
>> to destroy the widget but it still works, am I missing something
>
> Yes.  Hard to tell what.
>
> Yeti
>
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Iconview stock items

2012-01-14 Thread Neil Munro
I am working with an icon view and am trying to load stock items into
the gdk_pixbuf_new_from_file( ) but it's not working, I assume that is
perhaps because I am using the function wrong, is there a way to do
what I am trying to do?

I am following the tutorial here:
http://zetcode.com/tutorials/gtktutorial/gtkwidgetsII/ and simply
trying to swap out custom images for stock ones to use in my real
application once I have understood the principles correctly.

If anyone knows where I may be going wrong I would appreciate some
pointers, I know it's a widget like a treeview so requires a model and
that the model has a label and an image but beyond that without
getting the examples working I don't know how much I am understanding
is accurate or not.

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


Re: Re : Iconview stock items

2012-01-16 Thread Neil Munro
On 16 January 2012 19:01, Nicolas SOUBEIRAN  wrote:
> Use gtk_widget_render_icon_pixbuf
> If you need a custom size, you may look after gtk_icon_size_register
>
>

Is this a gtk3 function as I cannot find it as a function of a gtk2
widget: http://www.gtk.org/api/2.6/gtk/GtkWidget.html
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Re : Iconview stock items

2012-01-17 Thread Neil Munro
On 17 January 2012 18:20, Nicolas SOUBEIRAN  wrote:
> Le 17/01/2012 02:02, Neil Munro a écrit :
>
>> On 16 January 2012 19:01, Nicolas SOUBEIRAN
>>  wrote:
>>>
>>> Use gtk_widget_render_icon_pixbuf
>>> If you need a custom size, you may look after gtk_icon_size_register
>>>
>>>
>> Is this a gtk3 function as I cannot find it as a function of a gtk2
>> widget: http://www.gtk.org/api/2.6/gtk/GtkWidget.html
>>
> It is a gtk3 function the gtk2 equivalent is
>
> gtk_widget_render_icon
>
>  : http://www.gtk.org/api/2.6/gtk/GtkWidget.html#gtk-widget-render-icon
>

Excellent, however I am still stuck, if this function returns a pixbuf
and I pass it the stock_id and size I want, what widget do I need to
pass to it? Also what purpose does the detail parameter serve? I
thought I was coming to understand gtk+ until now, I am sure that what
I am trying to achieve is a trivial matter (I am ultimately creating a
iconview to essentially be a prettier way to navigate about a
notebook) but for some reason I am just getting stuck.

Again if anyone could offer any help I would be really grateful
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: Re : Iconview stock items

2012-01-22 Thread Neil Munro
I am still having issues with this, I have attached my test code for
reference, the code compiles but simply segfaults upon running, it's a
curious issue cos I can't see what I might be doing wrong.

On 18 January 2012 13:21, Nicolas Soubeiran  wrote:
> For the widget you should pass the iconview where you want to display the 
> stock.
> The "detail" parameter is for the theme engine, if you do not
> understand, it probably means that NULL should be OK.
> I recommend an update of Gtk to you. The 2.6 version you seem to use
> is a >5 years old version of GTK2 (cf the link you send). The current
> version is available on the gtk homepage. The Gtk-documentation has
> really been improved since.
>
>
>
> 2012/1/17 Neil Munro :
>> On 17 January 2012 18:20, Nicolas SOUBEIRAN  
>> wrote:
>>> Le 17/01/2012 02:02, Neil Munro a écrit :
>>>
>>>> On 16 January 2012 19:01, Nicolas SOUBEIRAN
>>>>  wrote:
>>>>>
>>>>> Use gtk_widget_render_icon_pixbuf
>>>>> If you need a custom size, you may look after gtk_icon_size_register
>>>>>
>>>>>
>>>> Is this a gtk3 function as I cannot find it as a function of a gtk2
>>>> widget: http://www.gtk.org/api/2.6/gtk/GtkWidget.html
>>>>
>>> It is a gtk3 function the gtk2 equivalent is
>>>
>>> gtk_widget_render_icon
>>>
>>>  : http://www.gtk.org/api/2.6/gtk/GtkWidget.html#gtk-widget-render-icon
>>>
>>
>> Excellent, however I am still stuck, if this function returns a pixbuf
>> and I pass it the stock_id and size I want, what widget do I need to
>> pass to it? Also what purpose does the detail parameter serve? I
>> thought I was coming to understand gtk+ until now, I am sure that what
>> I am trying to achieve is a trivial matter (I am ultimately creating a
>> iconview to essentially be a prettier way to navigate about a
>> notebook) but for some reason I am just getting stuck.
>>
>> Again if anyone could offer any help I would be really grateful
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

GTK3 VTE

2012-04-18 Thread Neil Munro
Hey all
  I am trying to convert a project from gtk2 to gtk3 using
both regular compilation and autotools, I can't seem to find much
about how to access vte. I currently type:
gcc `pkg-config --cflags --libs gtk+-3.0 vte` -o app app.c -Wall

Is vte referred to the most recent version based on the packages
installed on my system? Or can I target a particular vte version?

I also currently use the autotools macro
AC_CHECK_LIB([vte], [main])

To find vte, but it's inconsistent with how I check for everything
else I depend on as I tend to use PKG_CHECK_MODULES but am just really
struggling to find the correct documentation to solve this.

Any help is greatly appreciated.

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


GTK DND

2014-08-25 Thread Neil Munro
Hi all,
 I write an app called X2, which is a small programming editor
(yeah, I know, who DOESN'T have an editor these days) but I'm having some
difficulty deciding and implementing how to handle multiple drag and
drop... things.

I want (and currently handle) drag and drop files onto an application such
that a user can drop a file onto the app and have the application open the
file, but drag and drop within the app isn't handled causing a segmentation
fault from a null pointer.

You can see my code for handling DND here (
https://bitbucket.org/niadh/x2/src/7f8ee7a9a2f2d49474ba28a1ee1f64c86c10dd6b/src/callbacks.c?at=default,
line 402).

I know what causes the segmentation fault, but I am having difficulty
handling multiple DND targets(?) and any help would be much appreciated.

I do appreciate that my C might not be the best and any comments will be
met with humble appreciation (but obviously, no comments are required) I
wrote much of this app before I knew half of what I do now and it's going
to be cleaned up once this DND issue is resolved.

Thanks,
Neil 'Niadh' Munro.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list