Re: glade_xml_signal_autoconnect and user_data

2008-06-07 Thread Micah Carrick
To pass user data, you could either connect each signal using 
glade_xml_signal_connect() or you can write your own connect function 
using glade_xml_signal_autoconnect_full().


If you use GtkBuilder instead of LibGlade, you can pass the same 
user_data to each handler using gtk_builder_connect_signals().


- Micah Carrick

 Developer - http://www.micahcarrick.com
 GTK+ Forums - http://www.gtkforums.com



dhk wrote:
Is glade_xml_signal_autoconnect()only used for callbacks that don't take 
user_data?  If not, how can user_data be passed to a callback when using 
glade_xml_signal_autoconnect()?


Thanks,

Dave
___
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: How do I catch right-click on a TreeView header?

2008-05-29 Thread Micah Carrick
You may be able to use gtk_tree_view_column_get_widget() since *I think* 
it's a GtkLabel (if not, you can make it so using set_widget()) and then 
connect to the button-press-event of that widget.

- Micah Carrick

  Developer - http://www.micahcarrick.com
  GTK+ Forums - http://www.gtkforums.com



John M Collins wrote:
> Is there any way I can detect a right-click on a TreeView header?
>
> I have a sorted tree view and left click is sorting the rows according
> to the header just fine. "clicked" only applies to left clicks and I
> don't want to invoke what I want to be the right-click function every
> time I change the sort criterion.
>
> "button-press-event" only seems to happen for the main body of the
> TreeView not the header.
>
> Any advice would be appreciated.
>
> John Collins Xi Software Ltd www.xisl.com
>
>
> ___
> 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: Scrolling text in Gtk

2008-05-28 Thread Micah Carrick
In the book "Foundations of GTK+ Development", there is a chapter on 
creating custom widgets in which a marquee widget is created (which 
scrolls text across the widget).

You could take a look at the source code from the book available at 
www.gtkbook.com

- Micah Carrick

  Developer - http://www.micahcarrick.com
  GTK+ Forums - http://www.gtkforums.com



Tuvok wrote:
> Hi,
>
> What I need to do, is to make a bar with scrolling text inside it (like
> the bars with stock prices on tv).
>
> I've tried two methods, both of which are very slow. I've done it with
> Canvas and with Cairo. Below follows code.
>
> Did I do something wrong? Is there a way to make this code run faster?
> Should I use some different libraries for it?
>
>
> Rendering 4 such windows (1680x50) takes up 40-50% on both cores (AMD
> X2, 2.4GHz).
>
>
>
> Method I: Canvas
>
> The rendering part of code:
>
>GtkWidget *canvasWdg;
>GnomeCanvasItem *text;
>GnomeCanvasGroup *rootGroup;
>
>ifstream in(filename);
>string textLine;
>getline(in, textLine);
>
>canvasWdg = gnome_canvas_new();
>
>gtk_container_add(GTK_CONTAINER(window), canvasWdg);
>
>gnome_canvas_set_scroll_region(GNOME_CANVAS(canvasWdg), 0.0, 0.0,
> width*1.0,
>   height*1.0);
>rootGroup = gnome_canvas_root(GNOME_CANVAS(canvasWdg));
>
>text = gnome_canvas_item_new(rootGroup, GNOME_TYPE_CANVAS_TEXT, "x",
>   0.0, "y", 0.0, "text", textLine.c_str(),
> "anchor", GTK_ANCHOR_NW,
> "fill_color", "white", "size",
> (int)((height*0.7)*1000),
> "size-set", TRUE, NULL);
>
>double x1, x2, y1, y2;
>gnome_canvas_item_get_bounds(GNOME_CANVAS_ITEM(text), &x1, &y1, &x2,
> &y2);
> // align the text in window:
>gnome_canvas_item_move(GNOME_CANVAS_ITEM(text), 1.0*width,
>   ((height*1.0)/2-(y2-y1)/2));
>
>g_timeout_add(40, moveText, text);
>
>gtk_widget_show_all(window);
>
> and the timeout function:
>
> gboolean moveText(void *text)
> {
>
>gnome_canvas_item_move(GNOME_CANVAS_ITEM((GnomeCanvasItem*)text),
> -2.0, 0.0);
>
>return TRUE;
> }
>
>
>
> Method II: Cairo
>
> I've made a Gtk widget, which draws with cairo on expose event; I'll put
> here only the expose function:
>
> static gboolean mdk_text_scroller_expose(GtkWidget *textScroller,
> GdkEventExpose *event)
> {
>
>MdkTextScroller *ts = MDK_TEXT_SCROLLER(textScroller);
>
>
>cairo_t *cr;
>
>cr = gdk_cairo_create(textScroller->window);
>   
>  
>
> gdk_cairo_region(cr,
> event->region);   
>
>
> cairo_clip(cr);   
>   
>   
>
>
>cairo_select_font_face(cr, "Sans", CAIRO_FONT_SLANT_NORMAL,
> CAIRO_FONT_WEIGHT_NORMAL);
>
>cairo_set_font_size(cr, ts->size);
>cairo_move_to(cr, ts->x+ts->xOffset, ts->y+ts->yOffset);
>cairo_set_source_rgb(cr, 1.0, 1.0, 1.0);
>cairo_show_text(cr, ts->text);
>
>if (ts->width == 0 || ts->height == 0)
>{
>   cairo_text_extents_t ext;
>   cairo_text_extents(cr, ts->text, &ext);
>   ts->width = ext.width;
>   ts->height = ext.height;
>}
>
>if (ts->width+ts->xOffset+100 < 0)
>{
>   cairo_move_to(cr, ts->x+ts->xOffset+ts->width+100, ts->y
> +ts->yOffset);
>   cairo_show_text(cr, ts->text);
>}
>
>if (ts->x+ts->xOffset+ts->width < 0)
>{
>   ts->xOffset=ts->xOffset+ts->width+100;
>}
>
>
>cairo_stroke(cr);
>
>cairo_destroy(cr);
> }
>
> it's then redrawn with the same timeout call:
>
> gboolean moveText(void *text)
> {
>mdk_change_text_position((GtkWidget*)text, -1, 0);
>gtk_widget_queue_draw((GtkWidget*)text);
>
>return TRUE;
> }
>
>
>   
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Using GtkTreeViewDropPosition in drag and drop

2008-05-28 Thread Micah Carrick
I haven't worked with drag and drop all that much.

I have an application in which I'm dragging rows from one tree view onto 
another tree view. It's working great except for one piece...

Using the gtk_tree_view_get_dest_row_at_pos () in the "drag-motion" 
signal handler, I am able to get the GtkTreeViewDropPosition and change 
the drop indicator accordingly based on the return value (root nodes 
accept drop into, child nodes only show dropping before or after).

However, using that same call to gtk_tree_view_get_dest_row_at_pos () in 
the "drag-data-recieved" signal handler gets the path okay, but does not 
set the GtkTreeViewDropPosition. Thus, the row is not always dropped 
into the position that was indicated by the motion event.

Can anybody tell me why the GtkTreeViewDropPosition wouldn't be 
obtainable in the "drag-data-recieved" handler?

-- 
- Micah Carrick

  Developer - http://www.micahcarrick.com
  GTK+ Forums - http://www.gtkforums.com

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


Re: GtkBuilder and popup menus

2008-05-27 Thread Micah Carrick
I've moved this to the glade-users list since this popup is coming from 
a glade file and being run through gtk-builder-convert.

- Micah Carrick

  Developer - http://www.micahcarrick.com
  GTK+ Forums - http://www.gtkforums.com



Micah Carrick wrote:
> How do I use a  in a UI file with GtkBuilder? I can't set "id" on 
> the popup... do I have to get the GtkUIManager and get the popup menu 
> widget from that?
>
>   
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


GtkBuilder and popup menus

2008-05-26 Thread Micah Carrick
How do I use a  in a UI file with GtkBuilder? I can't set "id" on 
the popup... do I have to get the GtkUIManager and get the popup menu 
widget from that?

-- 
- Micah Carrick

  Developer - http://www.micahcarrick.com
  GTK+ Forums - http://www.gtkforums.com

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


Re: Drag and Drop Selection Content

2008-05-25 Thread Micah Carrick
Here's how I understand it...

In the "drag-data-get" callback I call 'g_array_free(tracks, FALSE) ' to 
free the struct but not it's data since gtk_selection_data_set() is 
going to copy it.

In the "drag-data-recieved" callback I call g_free() on the data, but do 
NOT call g_array_free as that is already going to be freed after the 
drag-drop is completed.

Sound right?

- Micah Carrick

  Developer - http://www.micahcarrick.com
  GTK+ Forums - http://www.gtkforums.com



Micah Carrick wrote:
> Let me be more clear...
>
> In my callback for "drag-data-get" I'm trying to pass on a GArray which 
> I use in my callback for "drag-data-recieved". I'm currently doing so 
> with this:
>
> gtk_selection_data_set (data,
> data->target,
> 8,
> (gpointer) tracks,
> sizeof (GArray));
>
> Where 'tracks' is a GArray of uint32_t integers.
>
> My question is, do I immediately free the tracks GArray there (but leave 
> the data preserved) and then free the data later in the 
> "drag-data-recieved" callback? Do I free the data at all?
>
> - Micah Carrick
>
>   Developer - http://www.micahcarrick.com
>   GTK+ Forums - http://www.gtkforums.com
>
>
>
> Micah Carrick wrote:
>   
>> In my handler for "drag-data-get" I need to set the selection data to an 
>> array of uint23_t integers. How would I do that using 
>> gtk_selection_data_set ()?
>>
>> I have a g_array() containing the uint32_t data...
>>
>>
>> Secondly, do I need to free the selection data in the handler for 
>> "drag-data-recieved" ?
>>
>>   
>> 
> ___
> 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: Drag and Drop Selection Content

2008-05-25 Thread Micah Carrick
Let me be more clear...

In my callback for "drag-data-get" I'm trying to pass on a GArray which 
I use in my callback for "drag-data-recieved". I'm currently doing so 
with this:

gtk_selection_data_set (data,
data->target,
8,
(gpointer) tracks,
sizeof (GArray));

Where 'tracks' is a GArray of uint32_t integers.

My question is, do I immediately free the tracks GArray there (but leave 
the data preserved) and then free the data later in the 
"drag-data-recieved" callback? Do I free the data at all?

- Micah Carrick

  Developer - http://www.micahcarrick.com
  GTK+ Forums - http://www.gtkforums.com



Micah Carrick wrote:
> In my handler for "drag-data-get" I need to set the selection data to an 
> array of uint23_t integers. How would I do that using 
> gtk_selection_data_set ()?
>
> I have a g_array() containing the uint32_t data...
>
>
> Secondly, do I need to free the selection data in the handler for 
> "drag-data-recieved" ?
>
>   
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Drag and Drop Selection Content

2008-05-25 Thread Micah Carrick
In my handler for "drag-data-get" I need to set the selection data to an 
array of uint23_t integers. How would I do that using 
gtk_selection_data_set ()?

I have a g_array() containing the uint32_t data...


Secondly, do I need to free the selection data in the handler for 
"drag-data-recieved" ?

-- 
- Micah Carrick

  Developer - http://www.micahcarrick.com
  GTK+ Forums - http://www.gtkforums.com

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


Mixing of memory allocation methods with application

2008-05-25 Thread Micah Carrick
I have a GTK application which is working with a C library (Libmtp). 
This C library uses standard C functions such as free, malloc, strndup, etc.

When I am working with a structure from this library, I should be using 
those same functions on those structures right? Because *my* parts of my 
application (elsewhere) are using the g_ functions.

For example, right now I have a structure coming from Libmtp for 
playlists. When renaming that playlist I used:

free (playlist->name);
playlist->name = g_strdup (new_name);

Is this going to cause problems? Should I make sure to use:

free (playlist->name);
playlist->name = strdup (new_name);


Also, these structures have arrays of tracks (uint32_t*). I have some 
routines which replace that array with the 'data' member of a GArray... 
that's probably *bad* since GArray doesn't use regular malloc()... right?

-- 
- Micah Carrick

  Developer - http://www.micahcarrick.com
  GTK+ Forums - http://www.gtkforums.com

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


Re: Scrolling to end of scrolled window when first displayed

2008-05-14 Thread Micah Carrick
There is an example of scrolling a GtkTextView to the end at 
http://www.gtkforums.com/about1307.html

If it's not working "initially" but works in callbacks, perhaps that is 
because the widget isn't shown yet.

After the text view and scrolled window have been shown, do

while (gtk_events_pending()) gtk_main_iteration ();

before trying to scroll to the end.

Or perhaps try connecting to the text view's "show" or "realized" 
signals. Not sure if that would work but it's an idea anyway.

- Micah Carrick

  Developer - http://www.micahcarrick.com
  GTK+ Forums - http://www.gtkforums.com



John M Collins wrote:
> I have a GtkTextView displaying some text - actually a log file in a
> Scrolled Window.
>
> I should like it to start off with the scroll at the bottom of the file
> - i.e. showing the most recent entry in the log file.
>
> How do I do this?
>
> I have tried:
>
> GtkAdjustment *adj =
> gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(scroll));
> gdouble val = adj->upper - adj->page_size;
> if  (val < adj->lower)
>   val = adj->lower;
> gtk_adjustment_set_value(adj, val);
>
> and also
>
> gtk_text_buffer_get_end_iter(textbuf, &iter);
> gtk_text_view_scroll_to_iter(GTK_TEXT_VIEW(view), &iter, 0.0, FALSE,
> 0.0, 1.0);
>
> But neither work initially - however they do work in callbacks once the
> window is up and running.
>
> Is there some "first time display" signal I need to put one of those in?
>
> Thanks for any help.
>
> John Collins Xi Software Ltd www.xisl.com
>
> ___
> 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: GtkTextView: how to stop default "paste-clipboard" handler ?

2008-05-13 Thread Micah Carrick
You may have to instead catch the Ctrl+V keybinding from within a 
handler for "key-press-event" and return TRUE to prevent further processing.

- Micah Carrick

  Developer - http://www.micahcarrick.com
  GTK+ Forums - http://www.gtkforums.com



Miroslav Rajcic wrote:
> I've needed to override the default GtkTextView pasting code in order to 
> support
> pasting of formatted text.
>
> My problem is that after adding the handler for "paste-clipboard" signal,
> the same text is pasted twice:
> - once as a formatted text,
> - and once more as a plain text (I suspect this other copy is due to default 
> signal handler).
>
> My code goes like this:
>
> g_signal_connect (G_OBJECT (textview1), "paste-clipboard", G_CALLBACK 
> (on_paste1_activate), NULL);
>
> void on_paste1_activate (GtkMenuItem *menuitem, gpointer user_data)
> {
> //g_signal_stop_emission_by_name(textview1, "paste-clipboard");
>
> //do my stuff here, paste will happen within the 
> MyClipboardTargetsReceivedFunc
> GtkClipboard *clipboard = gtk_widget_get_clipboard (textview1, 
> GDK_SELECTION_CLIPBOARD);
> gtk_clipboard_request_targets(clipboard, MyClipboardTargetsReceivedFunc, 
> NULL);
> }
>
> It appears if I add the call to stop signal emission (see commented line), 
> it actually kills my own handler instead of the system one.
> The result is that only plain text copy is pasted now.
>
> Can anyone recomend the way to kill the default handler for 
> "paste-clipboard" signal ? 
>
> ___
> 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


Best way to capture scrolling

2008-05-11 Thread Micah Carrick
What's the best signal for capturing when a GtkTextView is scrolled. I 
don't need to know how much or anything... just that it was scrolled 
either vertically OR horizontally by the mouse OR keyboard.

-- 
- Micah Carrick

  Developer - http://www.micahcarrick.com
  GTK+ Forums - http://www.gtkforums.com

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


Re: IP address entry widget

2008-01-06 Thread Micah Carrick
Andrew Krause's book "Foundations of GTK+ Development" uses an IP widget 
derived from an Entry as an example of writing custom widgets. Check it 
out at www.gtkbook.com

- Micah Carrick

  Developer - http://www.micahcarrick.com
  GTK+ Forums - http://www.gtkforums.com



Bin Chen wrote:
> Hi,
>
> Is there any type of IP address entry widget existed? I want to let
> user input the IP address in dot form, and strict their input to
> 0-255.
>
> Thanks.
> Bin
> ___
> 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: GtkTreeView row selection change events

2007-12-30 Thread Micah Carrick
I believe it's "row-activated" when a user double-clicks and 
"cursor-changed" when the selected row has changed.

- Micah Carrick

  Developer - http://www.micahcarrick.com
  GTK+ Forums - http://www.gtkforums.com



Christopher Harvey wrote:
> Hello GTKers,
> What is the event name that fires when the user changes the current
> GtkTreeView row selection, and what structure is it associated with? I'm
> willing to check the current selection on the mouse click event except I
> don't know if the current selection would be updated before or after I
> receive the click event. I'm using a single selection only TreeView if
> it matters.
> Thanks.
>
> ___
> 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: how to replace a child of a GtkBox ?

2007-12-30 Thread Micah Carrick
gtk_notebook_get_tab_label() will get the widget. That will give you the 
reference to your GtkHBox. You can 
then get the pointer to the GtkImage (assuming image is first child) from the 
children GList of the GtkBox. 
Just off my head, maybe something like...

GtkWidget *box, *image;

box = gtk_notebook_get_tab_label (GTK_NOTEBOOK (notebook));
image = GTK_WIDGET (g_list_first(box->children)->data); 
gtk_image_set_from_file (GTK_IMAGE (image), "new-image.png");

- Micah Carrick

  Developer - http://www.micahcarrick.com
  GTK+ Forums - http://www.gtkforums.com



Gregory Hosler wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> Hi all,
>
> I have a GtkNotebook, and for my tab's I built a GtkBox, with 2 children. a
> GtkImage image, and a label.
>
> Now I wish to update the GtkImage, either with another GtkImage, or replace it
> with a GtkPixbuf (depending upon, well, stuff...)
>
> My question(s):
>
>   - How do I remove the old object from the GtkBox ?
>
>   - How do I "free up" the old object (image/pixbuf) ? Do I
> simply unref it ?
>
>   - Is there an easier way to replace one child (of the GtkBox)
> with another object ? (as opposed to removing the old object
> and adding a new object).
>
>   - Since I'm replacing the FIRST object in the box, I assume that once
> I add the new object I will have to gtk_box_reorder_child() it to put
> it in the position I want, yes?
>
> Any thoughts, comments appreciated.
>
> Best rgds,
>
> - -Greg Hosler
>
> - --
> +-+
>
> Please also check the log file at "/dev/null" for additional information.
>   (from /var/log/Xorg.setup.log)
>
> | Greg Hosler [EMAIL PROTECTED]|
> +-+
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.7 (GNU/Linux)
>
> iD8DBQFHd1ro404fl/0CV/QRAiBKAJ49Rt2GjkEs2A4ZBPKPFNix+9tsjQCfSmJk
> uHrh0O37e5z6nvfzIkVv0xA=
> =mQQi
> -END PGP SIGNATURE-
> ___
> 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


Calling gtk-builder-convert from makefile

2007-12-20 Thread Micah Carrick
I have a glade file which I have to convert using gtk-builder-convert 
first. This converts it from .glade to .xml and the make file installs 
it. How would I run gtk-builder-convert on the source .glade file prior 
to copying the .xml file?

-- 
- Micah Carrick

  Developer - http://www.micahcarrick.com
  GTK+ Forums - http://www.gtkforums.com

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


Toolbars in Monodevelop

2007-12-11 Thread Micah Carrick
Does anybody know if the toolbars used by the application monodevelop 
are a library that might be available for C programmers like GDL is?

-- 
- Micah Carrick

  Developer - http://www.micahcarrick.com
  GTK+ Forums - http://www.gtkforums.com

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


Re: Developer COBOL + GTK

2007-12-07 Thread Micah Carrick
I don't know of COBOL for GTK. You can see a list of GTK+ programming 
language bindings at http://www.gtk.org/bindings.html

- Micah Carrick

  Developer - http://www.micahcarrick.com
  GTK+ Forums - http://www.gtkforums.com



Ronaldo Ottoni wrote:
> Hi, I am a developer of the COBOL language and would like to know if there
> is possibility of using the API GTK with the COBOL language, if there is a
> possibility, I would like to receive assistance from members.
> Thanks
>
> Ronaldo OTtoni
> ___
> 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: Nested Tree View

2007-11-30 Thread Micah Carrick
Typically, you would use two cell renderers for this task. For example, 
in a file browser, you might not have 1 column for the icon and another 
for the filename, but instead you could pack the icon renderer AND 
filename renderer into the column for a single column so that the 
alignment works.

col = gtk_tree_view_column_new();
gtk_tree_view_column_set_title(col, "Filename");
   
renderer = gtk_cell_renderer_pixbuf_new();
gtk_tree_view_column_pack_start(col, renderer, FALSE);
gtk_tree_view_column_set_attributes(col,
renderer,
"pixbuf",
FILE_ICON,
NULL);

renderer = gtk_cell_renderer_text_new();
gtk_tree_view_column_pack_start(col, renderer, TRUE);
gtk_tree_view_column_set_attributes(col,
renderer,
"text",
FILE_NAME,
NULL);
   
gtk_tree_view_append_column( GTK_TREE_VIEW 
(panel->priv->tree_view), col);

- Micah Carrick

  Developer - http://www.micahcarrick.com
  GTK+ Forums - http://www.gtkforums.com



Alejandro Serrano wrote:
> Hi,
> I'm trying to write a custom widget to represent some data in a way
> similar to this image: http://www.threatofchaos.com/imagenes/hsl2.PNG
> What I need is to "nest" items in a TreeView, but changing the set of
> columns that are represented. I mean, I need to have
>
> - Item 1
> - Item 2
>* SubItem 2.1
>* SubItem 2.2
> - Item 3
>* SubItem 3.1
>
> All Item 1, 2 and 3 would have the same set of columns. SubItems 2.1 and
> 2.2 would have another set of columns, and SubItem 3.1 another different
> one.
>
> I have been trying to use a combination of Expanders and TreeViews, but
> I feel that it's very inefficient, and I haven't found the way to have
> all the columns in the same set correctly aligned yet.
> Other option I was considering was creating some kind of new Cell
> Renderer that would include the SubItems. Is there any way to make a
> renderer that spans multiple columns and with a widget inside it?
>
> Thanks very much in advance,
> Alejandro Serrano
>
> ___
> 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: Application with plugins

2007-11-28 Thread Micah Carrick
You may want to take a look at how Gedit created a GObject-based plugin 
system.

- Micah Carrick

  Developer - http://www.micahcarrick.com
  GTK+ Forums - http://www.gtkforums.com



Adam Kłobukowski wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> I'm going do develop an application that allows custom plugins. Can GTK,
> Glib help me in any way with that?
>
> - --
> Semper Fidelis
>
> Adam Klobukowski
> [EMAIL PROTECTED]
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.6 (GNU/Linux)
>
> iD8DBQFHTa5SVVIYOc5drI0RArGEAJ9jFTNzWUbrxXR71GTM+V9xbiAl5ACcDiTl
> NEmsJ76YD6HZk+kz/EmqiqI=
> =CNnN
> -END PGP SIGNATURE-
> ___
> 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: Changing a style property?

2007-11-27 Thread Micah Carrick
You may want to look over the documentation of GtkRcStyle, resource 
files (.rc files for themes).

The "style" property of a widget is a GtkStyle object. There is no 
"shadow-type" property of a widget.

These are typically not used by the developer. We leave this stuff up to 
the theme. If we want a specific look (such as a touchscreen 
application) then we just write our own theme or resource file.

Read more at 
http://library.gnome.org/devel/gtk/2.12/gtk-Resource-Files.html#GtkRcStyle

- Micah Carrick

  Developer - http://www.micahcarrick.com
  GTK+ Forums - http://www.gtkforums.com



Andrew Smith wrote:
> Andrew Smith a écrit :
>   
>> Hi
>>
>> Can someone tell me how to change the 'style property' (as it's called 
>> in the reference manual) of a gtkwidget?
>>
>> Specifically right now I'm looking to change the 'shadow-type' property 
>> of gtkmenubar, gtktoolbar, and gtkcombobox. They look like crap on vista.
>>
>> I tried a g_object_set() but that says 'object class gtkmenubar has no 
>> property named shadow-type'.
>>
>> I can't find anything in the manual describing how to work with style 
>> properties, only some vague references to themes here and there. I would 
>> prefer to not have a theme, but I will write one if I have to, in which 
>> case would you please point me to a guide or a reference?
>>
>> Thanks in advance,
>>
>> Andrew
>>
>> 
> Sorry for the spam, but I just can't believe noone on the list knows how 
> to deal with this.
>
> Does my question not make sense? I can try and rephrase.
>
> Please help,
>
> Andrew
>
> ___
> 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: Feedback on my Win32 GTK+ Experience

2007-11-25 Thread Micah Carrick
Thank you for your response. It is very helpful.

- Micah Carrick

  Developer - http://www.micahcarrick.com
  GTK+ Forums - http://www.gtkforums.com



Tor Lillqvist wrote:
>> 1. libxml-2.0 from libxml2-2.6.30.win32.zip was missing the .pc file for 
>> pkg-config.
>> 
>
> I guess libxml2-2.6.30.win32.zip is the one on
> http://xmlsoft.org/sources/win32/ ? Please ask Igor Zlatkovic to
> include also the .pc file in his packages.
>
> http://ftp.gnome.org/pub/GNOME/binaries/win32/dependencies/libxml2-dev-2.6.27.zip
> (which is simply a slight repackaging by me of what Igor provides)
> does include the .pc file.
>
>   
>> I simply found this file in the sources elsewhere and copied
>> to C:\MinGW\lib\pkgconfig\libxml-2.0.pc. Is this normal?
>> 
>
> Yes and no. If you have the rest of libxml2 under c:\mingw, then it is
> the right thing to do.
>
> My personal preference is not to mix stuff from different sources. I
> keep only stuff from www.mingw.org in my mingw folder, and then I have
> a separate folder for stuff from gnuwin32.sourceforge.net, for
> instance, separate folders for things from GNOME SVN I have built
> myself (one folder for the current "stable" branch of things, one for
> the trunk, and one for each separate version of each package),
> separate folders for GNU libraries I have built (and distribute Win32
> binaries of) myself, etc.
>
>   
>> 2. zlib from zlib123-dll.zip had a couple of things. First, I had to
>> copy zlib1.dll to my bin/ directory. Secondly, the pkg-config files used
>> -lz as the linker flag, and thus I had to copy /lib/zdll.lib to
>> /lib/libz.a. The USAGE file said to rename zdll.lib to libzdll.a which I
>> ALSO did to ensure it works either way. Is this right? Why isn't it
>> libz.a already?
>> 
>
> Ask the people who make that package. Please understand that the
> distribution of Open Source software for Windows is not as tightly
> organized and managed as the packages for typical Linux distros. Some
> people do it one way, others another way.
>
>   
>> As I understand it, I can simply write my installer the
>> same way I did back in my Windows programming days and deploy it with
>> the DLL files necessary [as round] in the /bin dir.
>> 
>
> That is the way I recommend, yes. Keep the application executable and
> the DLLs of dependent libraries in the same "bin" folder of the
> run-time folder structure.
>
>   
>> 3. Is copying the .DLL dependencies to the system (\WINDOWS\SYSTEM32)
>> directory appropriate for the deployment of GTK+ applications on Win32?
>> I know it "works", but is that the standard convention?
>> 
>
> No. It is definitely not standard and correct these days. It used to
> be many years ago.
>
> --tml
>
>   
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Feedback on my Win32 GTK+ Experience

2007-11-24 Thread Micah Carrick
Hey everyone. I built a little GTK+/ Libglade project on Win32 over this 
holiday primarily just so I knew how to do it. However, I also have a 
project in the queue which will require this knowledge. I'm going over 
my installation notes getting ready to put them up on my blog, however, 
I was hoping to get some feedback on some of the issues I had first.

I opted for MinGW and MSYS as I would like to be able to deploy Windows 
versions without the need for cygwin and I understand MinGW is the 
correct choice for this. I primarily used the links from Tor Lillqvist’s 
GTK+ for Windows page to copy the necessary libraries (and dev headers). 
I had problems with 2 of the packages.

1. libxml-2.0 from libxml2-2.6.30.win32.zip was missing the .pc file for 
pkg-config. I simply found this file in the sources elsewhere and copied 
to C:\MinGW\lib\pkgconfig\libxml-2.0.pc. Is this normal?

2. zlib from zlib123-dll.zip had a couple of things. First, I had to 
copy zlib1.dll to my bin/ directory. Secondly, the pkg-config files used 
-lz as the linker flag, and thus I had to copy /lib/zdll.lib to 
/lib/libz.a. The USAGE file said to rename zdll.lib to libzdll.a which I 
ALSO did to ensure it works either way. Is this right? Why isn't it 
libz.a already?

Once I had it working, I wanted to figure out how I might deploy the 
application. As I understand it, I can simply write my installer the 
same way I did back in my Windows programming days and deploy it with 
the DLL files necessary as round in the /bin dir. I found that I can 
copy these to C:\WINDOWS\SYSTEM32\ on a target system which does not 
have cygwin or MinGW or anything else and my GTK+/Libglade application 
runs fine. I'm assuming this is what I would do to deploy a GTK+ windows 
application (using some kind of installer such as Nullsoft or Inno Setup 
making sure not to overwrite newer files).

3. Is copying the .DLL dependencies to the system (\WINDOWS\SYSTEM32) 
directory appropriate for the deployment of GTK+ applications on Win32? 
I know it "works", but is that the standard convention?

Thanks to anyone with the time to respond. I appreciate the help I've 
gotten thus far. Being limited on time I don't have much more time to 
research and I don't want to mislead readers of my blog. Not to mention, 
I would be more adept at helping people with their win32 quesions on 
http://www.gtkforums.com

-- 
- Micah Carrick

  Developer - http://www.micahcarrick.com
  GTK+ Forums - http://www.gtkforums.com

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


Re: Problem compiling on Windows

2007-11-23 Thread Micah Carrick
Argh. Duh. Cool, thanks. It's all working now. Thanks guys.

- Micah Carrick

  Developer - http://www.micahcarrick.com
  GTK+ Forums - http://www.gtkforums.com



Tor Lillqvist wrote:
>> Try gcc -Wall -g `pkg-config --cflags --libs libglade-2.0` -o hello hello.c
>> 
>
> Even that is wrong in general, and only works on some ELF-based
> platforms like Linux. To work on most platforms (including mingw), one
> has to specify the libraries *after* the object (source) files. This
> is how it has always been in Unix. Try:
>
> gcc -Wall -g `pkg-config --cflags libglade-2.0` -o hello hello.c
> `pkg-config --libs libglade-2.0`
>
> I would also make sure it uses "-o hello.exe" explicitly, just to
> avoid possible confusion. If you use autofoo and libtool, this should
> happen automatically.
>
> --tml
>
>   
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Problem compiling on Windows

2007-11-23 Thread Micah Carrick
Shoot, sorry. I meant

gcc -Wall -g `pkg-config --cflags --libs gtk+-2.0 libglade-2.0` -o hello hello.c

- Micah Carrick

  Developer - http://www.micahcarrick.com
  GTK+ Forums - http://www.gtkforums.com



Tristan Van Berkom wrote:
> On Nov 24, 2007 2:09 AM, Micah Carrick <[EMAIL PROTECTED]> wrote:
>   
>> I'm trying to learn how to build GTK+ applications on Windows XP. I have
>> installed GTK+ and dependencies from binaries as linked to from
>> http://www.gimp.org/~tml/gimp/win32/ and finally everything seems okay.
>> However, when I try to build a little libglade hello world application,
>> I get this:
>>
>> gcc -Wall -g `pkg-config --cflags --libs` -o hello hello.c
>>
>> 
>
> I  dont know about windows setups but I'm sure that `pkg-config --cflags 
> --libs`
> wont output anything if you dont specify a package.
>
> Try gcc -Wall -g `pkg-config --cflags --libs libglade-2.0` -o hello hello.c
>
> Cheers,
>-Tristan
>
>   
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Problem compiling on Windows

2007-11-23 Thread Micah Carrick
I'm trying to learn how to build GTK+ applications on Windows XP. I have 
installed GTK+ and dependencies from binaries as linked to from 
http://www.gimp.org/~tml/gimp/win32/ and finally everything seems okay. 
However, when I try to build a little libglade hello world application, 
I get this:

gcc -Wall -g `pkg-config --cflags --libs` -o hello hello.c

C:/DOCUME~1/Micah/LOCALS~1/Temp/ccGq.o: In function `main':
C:/msys/1.0/home/Micah/hello/hello.c:16: undefined reference to 
`gtk_init_abi_check'
C:/msys/1.0/home/Micah/hello/hello.c:19: undefined reference to 
`glade_xml_new'
C:/msys/1.0/home/Micah/hello/hello.c:20: undefined reference to 
`g_assert_warning'
C:/msys/1.0/home/Micah/hello/hello.c:23: undefined reference to 
`glade_xml_get_widget'
C:/msys/1.0/home/Micah/hello/hello.c:24: undefined reference to 
`glade_xml_get_widget'
C:/msys/1.0/home/Micah/hello/hello.c:27: undefined reference to 
`gtk_main_quit'
C:/msys/1.0/home/Micah/hello/hello.c:27: undefined reference to 
`glade_xml_signal_connect'
C:/msys/1.0/home/Micah/hello/hello.c:32: undefined reference to 
`glade_xml_signal_connect_data'
C:/msys/1.0/home/Micah/hello/hello.c:36: undefined reference to 
`g_type_check_instance_cast'
C:/msys/1.0/home/Micah/hello/hello.c:36: undefined reference to 
`g_object_unref'
C:/msys/1.0/home/Micah/hello/hello.c:39: undefined reference to `gtk_main'
C:/DOCUME~1/Micah/LOCALS~1/Temp/ccGq.o: In function 
`on_button1_clicked':
C:/msys/1.0/home/Micah/hello/hello.c:48: undefined reference to 
`gtk_entry_get_type'
C:/msys/1.0/home/Micah/hello/hello.c:48: undefined reference to 
`g_type_check_instance_cast'
C:/msys/1.0/home/Micah/hello/hello.c:48: undefined reference to 
`gtk_entry_set_text'
collect2: ld returned 1 exit status

Can anyone give me some advice?

BTW, the pkg-config output is:
-mms-bitfields -Ic:/MinGW/include/gtk-2.0 -Ic:/MinGW/lib/gtk-2.0/include 
-Ic:/MinGW/include/atk-1.0 -Ic:/MinGW/include/cairo 
-Ic:/MinGW/include/pango-1.0 -Ic:/MinGW/include/glib-2.0 
-Ic:/MinGW/lib/glib-2.0/include -Ic:/MinGW/include/libglade-2.0 
-Ic:/MinGW/include/libxml2 -Ic:/MinGW/include  -Lc:/MinGW/lib 
-lglade-2.0 -lgtk-win32-2.0 -lxml2 -lz -lws2_32 -lgdk-win32-2.0 
-latk-1.0 -lgdk_pixbuf-2.0 -lpangowin32-1.0 -lpangocairo-1.0 -lpango-1.0 
-lcairo -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -lintl -liconv  

-- 
- Micah Carrick

  Developer - http://www.micahcarrick.com
  GTK+ Forums - http://www.gtkforums.com

___
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 inserts a widget in the toolbar at the given position

2007-11-16 Thread Micah Carrick
I answered this in your post here: http://www.gtkforums.com/about876.html

 From the GtkToolItem API:

"GtkToolItems are widgets that can appear on a toolbar. To create a 
toolbar item that contain something else than a button, use 
gtk_tool_item_new(). Use gtk_container_add() to add a child widget to 
the tool item."

- Micah Carrick

  Developer - http://www.micahcarrick.com
  GTK+ Forums - http://www.gtkforums.com



sphurti durgade wrote:
> hello,
> how to inserts a widget in the toolbar at the given position. 
> because gtk_toolbar_insert_widget is deprecated 
>
> i tried with gtk_tool_button_new  (GtkWidget *icon_widget, const gchar 
> *label);
> instead of icon_widget i used other widget (e.g GtkHScale) it is able to show 
> hscale  in its default size , 
> but  not getting the control of scale , it acts like a button.
>  
> how i  can get control of hscale ?
> is it a right way to insert a widget in the toolbar ?
>
> can anybody  help me?
>
> Thank you 
> sphurti
>
>
>
>
>
>   Get the freedom to save as many mails as you wish. To know how, 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
>
>   
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Howto embed a window into a gtk application?

2007-10-05 Thread Micah Carrick
You can use the VTE terminal to embed a terminal into your GTK+ 
application: http://developer.gnome.org/arch/gnome/widgets/vte.html

- Micah Carrick

  Developer - http://www.micahcarrick.com
  GTK+ Forums - http://www.gtkforums.com



Frank Müller wrote:
> Hi.
>
> I'd like to embed an application (e.g. xterm) into my gtk application. Does 
> anyone know a way how to do this or what functions I could use for this 
> purpose?
>
>   
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


GnomeVFS, gvfs, and FUSE

2007-10-03 Thread Micah Carrick
I have been reading that GnomeVFS should be avoided in the future. I 
have a GNOME application which works on text files opened locally or 
remotely via FTP and SSH using GnomeVFS.

Should I move towards other options, such as FUSE? Is GVFS going to be 
the "next" GnomeVFS?

-- 
- Micah Carrick

  Developer - http://www.micahcarrick.com
  GTK+ Forums - http://www.gtkforums.com

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


Re: Problem to open a new window using libglade

2007-03-02 Thread Micah Carrick
Sorry, just use gtk_widget_show()

- Micah Carrick
  Developer | http://www.micahcarrick.com | http://www.gtkforums.com



patrick wrote:
> If I compile it with "gtk_window_show_now" I get the following compiler error:
> implicit declaration of function 'gtk_window_show_now'
> I also tried it with 'gtk_widget_show_now', but there is no difference.
>
> 2007/3/2, Micah Carrick <[EMAIL PROTECTED]>:
>   
>> A quick "cheap trick" you could do is:
>>
>> gtk_window_set_keep_above (GTK_WINDOW(window2), TRUE);
>> gtk_window_show_now (GTK_WINDOW(window2));
>>
>> - Micah Carrick
>>   Developer | http://www.micahcarrick.com | http://www.gtkforums.com
>>
>>
>>
>> patrick wrote:
>> 
>>> Hi All,
>>>
>>> I'd like to open a new window, when a button is clicked by using libglade.
>>> But the window appears always at the end of the function, but it
>>> should appear at the beginnig, so that I can show the progrwess to the
>>> user.
>>> I also tried to add "while (gtk_events_pending())
>>> gtk_main_iteration();" but then only the outlines are visible, not the
>>> labels, and progressbars.
>>>
>>> So I put together a short example to explain the problem.
>>> Now the window appears with the beginning of the break, but the labels
>>> etc, at the end.
>>> How can I open the window, so that the labels etc. are visible, to
>>> show the progress to the user?
>>> thanks a lot!
>>>
>>> Patrick
>>>
>>> /* sample.glade */
>>>
>>>  
>>> http://glade.gnome.org/glade-2.0.dtd";>
>>>
>>> 
>>>
>>> 
>>>   10
>>>   True
>>>   window1
>>>   GTK_WINDOW_TOPLEVEL
>>>   GTK_WIN_POS_NONE
>>>   False
>>>   False
>>>   False
>>>   True
>>>   False
>>>   False
>>>   GDK_WINDOW_TYPE_HINT_NORMAL
>>>   GDK_GRAVITY_NORTH_WEST
>>>   True
>>>   False
>>>
>>>   
>>> 
>>>   150
>>>   True
>>>   True
>>>   Run
>>>   True
>>>   GTK_RELIEF_NORMAL
>>>   True
>>>   >> last_modification_time="Mon, 19 Feb 2007 20:34:21 GMT"/>
>>> 
>>>   
>>> 
>>>
>>> 
>>>   10
>>>   True
>>>   window2
>>>   GTK_WINDOW_TOPLEVEL
>>>   GTK_WIN_POS_NONE
>>>   False
>>>   False
>>>   False
>>>   True
>>>   False
>>>   False
>>>   GDK_WINDOW_TYPE_HINT_NORMAL
>>>   GDK_GRAVITY_NORTH_WEST
>>>   True
>>>   False
>>>
>>>   
>>> 
>>>   True
>>>   False
>>>   0
>>>
>>>   
>>>
>>>  True
>>>  Progress window
>>>  False
>>>  False
>>>  GTK_JUSTIFY_LEFT
>>>  False
>>>  False
>>>  0.5
>>>  0.5
>>>  0
>>>  0
>>>  PANGO_ELLIPSIZE_NONE
>>>  -1
>>>  False
>>>  0
>>>
>>>
>>>  0
>>>  False
>>>  False
>>>
>>>   
>>>
>>>   
>>>
>>>  True
>>>  GTK_PROGRESS_LEFT_TO_RIGHT
>>>  0
>>>  0.1000149
>>>  PANGO_ELLIPSIZE_NONE
>>>
>>>
>>>  0
>>>  False
>>>  False
>>>
>>>   
>>>
>>>   
>>>
>>>  True
>>>  >> translatable="yes">progress_description
>>>  False
>>>  False
>>>  GTK_JUSTIFY_LEFT
>>>  False
>>>  False
>>>  0.5
>>>  0.5
>>>  0
>>>  0
>>>  PANGO_ELLIPSIZE_NONE
>>>  -1
>>>  False
>>>  0
>>>
>>>
>>>  2
>>>  False
>>>  False
>>>
>>>   
>>> 
>>>   
>>> 
>>>
>>> 
>>>
>>>
>>> /* sample.c */
>>> #include 
>>> #include 
>>> #include 
>>>
>>> #define GLADE_FILE "sample.glade"
>>>
>>> // fu

Re: Problem to open a new window using libglade

2007-03-01 Thread Micah Carrick
A quick "cheap trick" you could do is:

gtk_window_set_keep_above (GTK_WINDOW(window2), TRUE);
gtk_window_show_now (GTK_WINDOW(window2));

- Micah Carrick
  Developer | http://www.micahcarrick.com | http://www.gtkforums.com



patrick wrote:
> Hi All,
>
> I'd like to open a new window, when a button is clicked by using libglade.
> But the window appears always at the end of the function, but it
> should appear at the beginnig, so that I can show the progrwess to the
> user.
> I also tried to add "while (gtk_events_pending())
> gtk_main_iteration();" but then only the outlines are visible, not the
> labels, and progressbars.
>
> So I put together a short example to explain the problem.
> Now the window appears with the beginning of the break, but the labels
> etc, at the end.
> How can I open the window, so that the labels etc. are visible, to
> show the progress to the user?
> thanks a lot!
>
> Patrick
>
> /* sample.glade */
>
>  
> http://glade.gnome.org/glade-2.0.dtd";>
>
> 
>
> 
>   10
>   True
>   window1
>   GTK_WINDOW_TOPLEVEL
>   GTK_WIN_POS_NONE
>   False
>   False
>   False
>   True
>   False
>   False
>   GDK_WINDOW_TYPE_HINT_NORMAL
>   GDK_GRAVITY_NORTH_WEST
>   True
>   False
>
>   
> 
>   150
>   True
>   True
>   Run
>   True
>   GTK_RELIEF_NORMAL
>   True
>last_modification_time="Mon, 19 Feb 2007 20:34:21 GMT"/>
> 
>   
> 
>
> 
>   10
>   True
>   window2
>   GTK_WINDOW_TOPLEVEL
>   GTK_WIN_POS_NONE
>   False
>   False
>   False
>   True
>   False
>   False
>   GDK_WINDOW_TYPE_HINT_NORMAL
>   GDK_GRAVITY_NORTH_WEST
>   True
>   False
>
>   
> 
>   True
>   False
>   0
>
>   
>
>  True
>  Progress window
>  False
>  False
>  GTK_JUSTIFY_LEFT
>  False
>  False
>  0.5
>  0.5
>  0
>  0
>  PANGO_ELLIPSIZE_NONE
>  -1
>  False
>  0
>
>
>  0
>  False
>  False
>
>   
>
>   
>
>  True
>  GTK_PROGRESS_LEFT_TO_RIGHT
>  0
>  0.1000149
>  PANGO_ELLIPSIZE_NONE
>
>
>  0
>  False
>  False
>
>   
>
>   
>
>  True
>  progress_description
>  False
>  False
>  GTK_JUSTIFY_LEFT
>  False
>  False
>  0.5
>  0.5
>  0
>  0
>  PANGO_ELLIPSIZE_NONE
>  -1
>  False
>  0
>
>
>  2
>  False
>  False
>
>   
> 
>   
> 
>
> 
>
>
> /* sample.c */
> #include 
> #include 
> #include 
>
> #define GLADE_FILE "sample.glade"
>
> // functions
> static gint delete_event_cb(GtkWidget* w, GdkEventAny* e, gpointer data);
> static gint destroy_cb(GtkWidget* w, GdkEventAny* e, gpointer data);
> static void on_button1_clicked(GtkButton *button, gpointer data);
>
> int main (int argc, char *argv[])
> {
>   GladeXML *gxml;
>
> gtk_init (&argc, &argv);
>
>   //Create interface
> gxml = glade_xml_new (GLADE_FILE, "window1", NULL);
>
>   GtkWidget *window1 = glade_xml_get_widget(gxml, "window1");
>
>   //connect signals
>   glade_xml_signal_connect_data (gxml, "on_button1_clicked",
> G_CALLBACK (on_button1_clicked), NULL);
>
> g_signal_connect(G_OBJECT(window1), "delete_event",
> G_CALLBACK(delete_event_cb), NULL);
>
> g_signal_connect(G_OBJECT(window1), "destroy",
> G_CALLBACK(destroy_cb), NULL);
>
>   //beginn loop
> gtk_main ();
>
> return 0;
> }
>
> static gint delete_event_cb(GtkWidget* w, GdkEventAny* e, gpointer data)
> {
> return 0;
> }
>
> static gint destroy_cb(GtkWidget* w, GdkEventAny* e, gpointer data)
> {
> gtk_main_quit();
> return 0;
> }
>
> void
> on_button1_clicked(GtkButton *button, gpointer data)
> {
>   /* the button was clicked */
>   //Print out to console
>   g_print("Beginn break\n");
>
>   //Create the new "progress" window
>   GladeXML*gxml_progress = NULL;
>   gxml_progress = glade_xml_new (GLADE_FILE, "window2", NULL);
>
>   //show the window
>   GtkWidget *window2 = glade_xml_get_widget(gxml_progress, "window2");
>   gtk_widget_show_all(window2);
>
>   while (gtk_events_pending())
>   gtk_main_iteration();
>
>   //Make 5 sec. break
>   g_usleep(500);
>   g_print("End break\n");
> }
>
> I compile it with: "gcc -Wall -export-dynamic -g `pkg-config --cflags
> --libs gtk+-2.0` `pkg-config --cflags --libs libglade-2.0` -o sample
> sample.c" on my FC6 machine.
> ___
> 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: question about tabs on notebook

2007-02-25 Thread Micah Carrick
Do you mean which tab is selected by default when the program starts? If 
so, before showing the notebook, assuming that the first tab is selected 
by default, call gtk_notebook_next_page(). You could also use 
gtk_notebook_set_current_page() to explicitly select the 2nd page by 
passing 1 as the index.

If you mean that you want the 2nd page to be where the 1st page 
currently is, why not just change the glade file?

- Micah Carrick
  Developer

http://www.micahcarrick.com | http://www.gtkforums.com

shawn bright wrote:
> Hello there all,
>
> i am using GTK and glade to create a front end to our data engine.
> The thing is, it uses a notebook with 4 tabs. Is there any way I can
> change the order of tabs ? i would really like tab 2 to show up first
> when the program is run.
>
> thanks for any tips.
>
> shawn
> ___
> 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


gtk_print_operation_run warnings

2007-01-23 Thread Micah Carrick
Can anybody help me with the following errors?

** (printing:10547): WARNING **: Error getting printer list: Too many 
failed attempts

** (printing:10547): WARNING **: Error result: Too many failed attempts

These 2 warning are output whenever the print dialog recieves a mouse 
click on any widget in the window. The dialog returns 
GTK_PRINT_OPERATION_RESULT_APPLY and the print operation is a success, 
but still those warnings have me curious. I do not have a printer 
installed but am using the "Print to file" printer.

Dialog was run using:

res = gtk_print_operation_run (operation, 
GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG, 
 GTK_WINDOW (w->window), &error);


-- 
- Micah Carrick
  Developer - http://www.micahcarrick.com | http://www.gtkforums.com
  

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


Re: move cursor with keyboard in a window

2007-01-13 Thread Micah Carrick
[EMAIL PROTECTED] wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> On Fri, Jan 12, 2007 at 10:52:41AM -0800, Micah Carrick wrote:
>   
>> [EMAIL PROTECTED] wrote:
>> 
> [...]
>
>   
>> Here is example code using C/GTK+ (and GDK):
>> http://www.gtkforums.com/viewtopic.php?p=462
>> 
>
> Nice. So I don't have to cook up an example now :-)
>
> Micah -- I see you are collecting short GTK+ examples. Feel free to
> recycle the grab example I posted the other day (if it fits in your
> collection).
>   
Sure thing, thanks.
> Regards
> - -- tomás
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.1 (GNU/Linux)
>
> iD8DBQFFqKBHBcgs9XrR2kYRApMEAJ48yXb2mjL0KmbaLQNkKbmy4botZACfU/U7
> rbpI24kzXU3TRcj+F5h3Xic=
> =PleB
> -END PGP SIGNATURE-
>
>
>   


-- 
- Micah Carrick
  Freelance Developer
  http://www.micahcarrick.com | http://www.gtkforums.com

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

Re: move cursor with keyboard in a window

2007-01-12 Thread Micah Carrick
[EMAIL PROTECTED] wrote:
> Hello!!
> I'm learning about gtk...and i need your help!
> I've to buid a program wich creates a main window, while i'll be inside it 
> will
> be with a cursor(all this part i know how to do it), and the problem is that i
> want to move the cursor with up/down/right/left arrows of my keyboard.
> Can you tell me an example about how to do it??
>
> thanks a lot.
>
>
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>
>   
Here is example code using C/GTK+ (and GDK):
http://www.gtkforums.com/viewtopic.php?p=462

-- 
- Micah Carrick
  Freelance Developer
  http://www.micahcarrick.com | http://www.gtkforums.com

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


Re: Button -> Launch context menu? ^^

2007-01-11 Thread Micah Carrick
briansteffens wrote:
> Hi everyone.. I'm just getting my feet wet developing with Gtk+, a recent
> convert from Win32/.NET. I'm developing on Debian Etch + Xorg + Gnome in
> C++. I'm having trouble finding many Gtk+ resources (API lists and
> examples), so if you happen to know of a good website, please pass that on
> =)
>
> On to my real question. I'm trying to design a small Gnome panel applet, and
> I want to have a button, which when clicked will display a context menu. So
> basically I need to know the call to display a menu.
>
> Thanks in advance! :)
>   
I have some GTK+ forum started which is slow starting but just about any 
basic question will get answered...
http://www.gtkforums.com

I have links to numerous GTK+ resources here:
http://www.micahcarrick.com/v2/component/option,com_weblinks/catid,6/Itemid,29/

I have my own GTK+/Glade/Gnome tutorials here:
http://www.micahcarrick.com/v2/content/category/1/17/20/

GTK+ (and some other libraries) API documentation here:
http://developer.gnome.org/doc/API/

Specifically how to add a popup menu from the GTK+ FAQ:
http://www.mhatt.aps.anl.gov/dohn/programming/gtk-2.0/gtk-faq/x670.html

The gtk_menu_popup() function in the GTK+ API Docs:
http://developer.gimp.org/api/2.0/gtk/GtkMenu.html#gtk-menu-popup

Cheers,

-- 
- Micah Carrick
  Freelance Developer
  http://www.micahcarrick.com | http://www.gtkforums.com

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


Re: Question about GtkComboBox entry....

2007-01-11 Thread Micah Carrick
Russell Markus wrote:
> I am a Glade/GTK newbie and I am building an application similar to a chat
> program.  I have a GtkComboBox field where the user can type in his message
> and I would like to be able to send the message when the user presses the
> enter key.  Currently, when the user presses the enter key, the combo list
> drops down.  Is there a way to trap the enter key so that I can send the
> message?
>
> Thanks for any help.
>
> Russell Markus
> Sr. Software Engineer
> IPMobileNet, Inc.
> (949)417-4590 
>
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>
>   
Use the "key-press-event" if the keycode is the enter key, and return 
TRUE from the handler to prevent the event from being further 
propogated. I created a little demo app for which the source can be seen 
here: http://www.gtkforums.com/viewtopic.php?p=457

-- 
- Micah Carrick
  Freelance Developer
  http://www.micahcarrick.com | http://www.gtkforums.com

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


Re: GtkPlot

2007-01-08 Thread Micah Carrick
Luka Napotnik wrote:
> Where can I get a decent example of GtkPlot usage?
>
> greets,
> Luka
>
>   
Download the source from 
http://gtkextra.sourceforge.net/src/gtkplot-5.0.tar.gz, build the source 
using 'make' and then run ./demo (and view demo.c for how it's done).

-- 
- Micah Carrick
  Freelance Developer
  http://www.micahcarrick.com | http://www.gtkforums.com

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


Re: Anyone know how to use a larger font for an entire application using Glade?

2007-01-05 Thread Micah Carrick
Russell Markus wrote:
> I have developed an application using Glade-2 on Fedora Core 6.  I have had
> a request to make all of the text larger.  Is there an easy way to use a
> larger font for the entire application or do I have to use the markup
> settings for each widget individually?
>
> Thanks for any information.
>
> Russell Markus
> Sr. Software Engineer
> IPMobileNet, Inc.
> (949)417-4590 
>
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>
>   
I believe the idea is to allow the user to specify font size rather than 
the application. Part of Desktop GUI development is allowing your 
program to fit the customer's needs (ie 10 years ago I preferred tiny 
little fonts, and now that I'm going blind they get progressively larger).

Font sizes are specified in 'System' -> 'Preferences' -> 'Fonts' under 
GNOME in FC6.

If you really want to specify your own font, you may want to use an rc 
file: http://developer.gnome.org/doc/API/2.2/gtk/gtk-Resource-Files.html

-- 
- Micah Carrick
  Freelance Developer
  http://www.micahcarrick.com | http://www.gtkforums.com

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


Re: GtkEntry text selection

2007-01-03 Thread Micah Carrick
You can use the "focus" signal to set the cursor position using 
gtk_editable_set_position with a position of -1 to indicate the end of 
the text.

- Micah Carrick
  http://www.micahcarrick.com   |   http://www.gtkforums.com

Anurag Chaudhary wrote:
> When I bring focus to a GtkEntry, all of its text gets selected by 
> default. How can I disable this behaviour?
> I want the text to remain un-selected and cursor in the end.
>
> Thanks
> Anurag
>
> _
> Tried the new MSN Messenger? It's cool! Download now. 
> http://messenger.msn.com/Download/Default.aspx?mkt=en-in
>
> 
>
> ___
> 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: Trimming GtkEntry Text

2006-12-21 Thread Micah Carrick
(custom_command == NULL || sizeof(custom_command) <= 0)

custom_command is a gchar pointer, so, using sizeof simply gives you the 
size of the pointer, not the length of the string. 
"sizeof(custom_command) <= 0" will always be the size of a gchar pointer 
(4 bytes on my system).

If you're looking for the length of characters in the string, try using 
g_utf8_strlen() instead.

- Micah Carrick
  www.micahcarrick.com www.gtkforums.com



Tony Freeman wrote:
> Hello,
>
> I have two problems I'm trying to work through that maybe someone here
> can help me with.
>
> I have a GtkEntry called a 'custom_command_entry'.  I would like to trim
> white space from the beginning and end of what a user may enter in this
> field.  custom_command_entry is a global.
>
> This is what I have so far:
>
> void on_executebutton_clicked (GtkWidget *widget, gpointer data)
> {
>   const gchar *custom_command;
>   gchar *entry_wfo1, *entry_wfo2;
>
>   /* GET THE BACKUP WFO SELECTION */
>   entry_wfo1 = gtk_combo_box_get_active_text(GTK_COMBO_BOX(combobox1));
>   
>   /* GET THE LOCALIZED WFO SELECTION */
>   entry_wfo2 = gtk_combo_box_get_active_text(GTK_COMBO_BOX(combobox2));
>   
>   /* GET THE CUSTOM COMMAND */
>   custom_command =
> g_strdup(gtk_entry_get_text(GTK_ENTRY(custom_command_entry)));
>   g_strstrip(custom_command);
>   
>   if (custom_command == NULL || sizeof(custom_command) <= 0) {
>   g_print("entry1 = %s :: entry2 = %s \n", entry_wfo1, 
> entry_wfo2);
>   } else {
>   g_print("Custom Command: %s\n", custom_command);
>   }
>   
>   gtk_widget_show(confirmdialog);
> }
>
> The 'if' statement above ALWAYS returns false, so that the custom
> command is always printed to output even if there is nothing to print.
>
> The idea is that the user can override the default command to run by
> typing in a command in the 'custom_command_entry' GtkEntry field.  If
> there is no command there, just whitespace, then the program needs to
> run the default command.
>
> Please help!
>
> -- Tony
>
>
> ___
> 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