Re: Title on gnome-shell

2018-02-27 Thread Florian Müllner
On Tue, Feb 27, 2018 at 1:59 PM, Takao Fujiwara  wrote:
> How can I set the title name of GtkWindow on gnome-shell?

gtk_window_set_title(), but that's probably not what you mean - there
are few places where gnome-shell uses the window title, in general the
application name is more prominent. For that it is important that
gnome-shell finds the .desktop file that corresponds to the window.
There are several options for making that work, most importantly:

 - use GtkApplication with an ID that corresponds to the .desktop file
   (for example "com.example.Foo" and com.example.Foo.desktop)

 - set the WM_CLASS property to the .desktop file name
  (e.g. g_setprgname("foo-bar"); and foo-bar.desktop)

 - set the StartupWMClass field in the .desktop file to the WM_CLASS
   of your program

Refer to https://wiki.gnome.org/Projects/GnomeShell/ApplicationBased
for more details.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: GtkTextView - The “extend-selection” signal

2018-01-19 Thread Florian Müllner
On Wed, Jan 17, 2018 at 3:19 PM, Lucky B.C  wrote:
> I'm trying to get the range of the selected word by
> gtk_text_iter_get_offset (start) and gtk_text_ter_get_offset (end) on
> the “extend-selection” signal,

Right, that doesn't work. There is no selected word when the signal
handler is run, as it's the handler itself that is responsible for
*setting* the selection in the first place. That is, both 'start' and
'end' are uninitialized and the handler is expected to set them to the
start and end of the word (or line). If you are fine with the
selection that the default signal handler provides and want to get the
selection bounds, you can connect to the 'notify::has-selection'
signal on the text view's buffer and use
gtk_text_buffer_get_selection_bounds() to get the range.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: Window icon is not shown in gnome shell dash under wayland

2017-12-03 Thread Florian Müllner
On Sun, Dec 3, 2017 at 11:39 AM, rastersoft  wrote:
> Thanks. That explains the problem: the .desktop file differs from the
> program because the program ends in .py :(

GNOME Shell does not *really* use the binary name to match .desktop
files, but the WM_CLASS (X11) or application-id (wayland) property.
GTK+ sets those from the program name, either determined automatically
or from the value specified by g_set_prgname() - that is, you should
be able to fix this issue by calling that function with an appropriate
value before creating the first window.

Cheers,
Florian
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Making a GtkSeparator more visible

2017-12-01 Thread Florian Müllner
On Fri, Dec 1, 2017 at 12:33 PM, Felipe Borges  wrote:

> You could make it darker by setting some css properties for its css
> node [...]

Of course thanks to the joys of theming, making separators *darker*
may end up making them *less* visible if the user happens to use the
"wrong" theme. Some theme issues can be avoided by using named colors
instead of hardcoded values:

separator {
  background-color: shade(@borders, 0.9);
}

But not whether making elements lighter or darker will make them more
or less similar to the background :-(
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: customized alignment in gtk text view

2017-06-01 Thread Florian Müllner
Hey,

this is not a question about the development of GTK+, but about using GTK+
for app development - gtk-app-devel-list is a better place for this, so
moving there.

On Thu, Jun 1, 2017 at 3:10 PM Karan Ahuja  wrote:

>
> I wish to display 3 lines in gtk textview as below
>
> software-lumapix  +2000
> software-adigiprints  +3000
> software-yst  +3000
>
> on command line i see the strings as above as required.
>

That is beccause terminals usually use monospace fonts, that is every
character takes up the same width. So using a fixed character could for
alignment works in that context ...



> but when i copy the output from commandline to gtk text view or gmail here
> or use
> set_text method on the text buffer - the alignment is lost and i see this
>
> software-lumapix  +2000
> software-adigiprints  +3000
> software-yst  +3000
>


... while it doesn't in contexts where variable-width fonts are used (where
for example "l" and "i" take up less width than "m" and "w").


my simple code is as below in python gtk+
>
> str1 = '{message: <{width}}'.format(message="software-lumapix", width=50)
> str1 = str1+'+2000'
> print str1
> str2 = '{message: <{width}}'.format(message="software-adigiprints",
> width=50)
> str2 = str2+'+3000'
> print str2
> str3 = '{message: <{width}}'.format(message="software-yst", width=50)
> str3 = str3+'+3000'
> print str3
> self.view.get_buffer().set_text(str1+'\n'+str2+'\n'+str3)
>
>
> Please guide - how can i align the numbers right aligned.
>

One option is to set custom tab stops with gtk_text_view_set_tabs(), and
then append '\t' to each string on the left instead of setting a character
width.

Cheers,
Florian
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Application.activate not emitted when opening files.

2016-06-16 Thread Florian Müllner
On Thu, Jun 16, 2016 at 9:11 PM Stefan Salewski  wrote:

> So your observed behaviour seems to be intended. When application is
> started with arguments, example_app_open() is called, which includes
> the code of example_app_activate(). This indicates that
> example_app_activate() is not executed when application is started with
> arguments, so we can assume that "activate" signal is not emitted for
> that case. (That was not clear for me from the docs)


It is a bit hidden in the documentation for g_application_run()[0]:
"If there are no files listed, the application is activated via the
"activate" signal. If there are one or more files, and
G_APPLICATION_HANDLES_OPEN was specified then the files are opened via the
"open" signal."

[0]
https://developer.gnome.org/gio/stable/GApplication.html#g-application-run
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Custom Titlebar

2014-08-11 Thread Florian Müllner
On Sun, Aug 10, 2014 at 7:31 PM, Michael Cronenworth m...@cchtml.com wrote:
 On 08/09/2014 04:25 PM, Mahan Marwat wrote:

 How can I add a custom titlebar to my GUI application?


 Are you asking for custom text or a complete replacement with widgets of
 your own?

 [...]

 If the later, GTK does not support that.


That is not quite true - since GTK 3.10, there's

  gtk_window_set_titlebar (GTK_WINDOW (window), titlebar_widget);
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Fwd: Can't link to Pango

2014-02-13 Thread Florian Müllner
Ooops, I missed replying to the list as well ...

-- Forwarded message --
From: Florian Müllner fmuell...@gnome.org
Date: Thu, Feb 13, 2014 at 2:14 PM
Subject: Re: Can't link to Pango
To: Bric b...@flight.us


On Thu, Feb 13, 2014 at 8:45 AM, Bric b...@flight.us wrote:
 Here is my config.log :

 http://www.flight.us/misc/gtk_config.log.txt

Here's the actual linker error:

 /usr/local/lib/libpangocairo-1.0.so: undefined reference to 
 `pango_fc_font_create_base_metrics_for_context'

So for some reason, your custom-built libpangocairo references a
symbol that the linker cannot resolve. Either something went wrong
when you built pango, or you found a bug and pangocairo
unconditionally references symbols from pangoft2 even when built
without freetype support. In the latter case you should file a bug
report, though you almost certainly want pango *with* freetype support
- make sure you have the required headers (harfbuzz, fontconfig,
freetype2) and rebuild pango.

Hope that'll help you get back on track!

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

Re: Fulscreen mode

2013-06-17 Thread Florian Müllner
On Mon, Jun 17, 2013 at 6:46 PM, John Coppens j...@jcoppens.com wrote:
 I would like to make DArea full-screen, if possible even hiding the
 window borders.

gtk_window_fullscreen() will ask the window manager to fullscreen the
window, which should work as expected on most commonly used WMs.

The canonical way of adjusting your UI according to the fullscreen
state is to connect to the window's 'window-state-event' signal and
adjust the visibility of elements according to the new state.


 Is the only way to do that, hiding the VBox with the
 Menu, Treevw1 etc, then unhiding DArea?

No, DArea will not be visible if its parent is hidden. You will need
to show/hide Menu, Treevw1, ... explicitly.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Help Broadway Backend

2013-02-09 Thread Florian Müllner
On Sat, Feb 9, 2013 at 12:39 AM, Diego Felix (Bill) diegob...@gmail.com wrote:
 I tried to make the gtk+ from git repository (branch broadway)

Why? That's an old development branch that has long been merged to
master; to build the broadway backend, just configure GTK+ (master or
any version = 3.2) with --enable-broadway-backend.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: can anybody help me figure out why the two hbox buttons don't show?

2011-12-13 Thread Florian Müllner
On mar, 2011-12-13 at 15:02 -0800, Gary Kline wrote:
 anybody know where i'm messing up?


 int
 main (void)
 {
 GtkWidget *window;
 GtkWidget *vbox, *hbox;

[...]
 gtk_container_add (GTK_CONTAINER (window), vbox);
[...]
   gtk_container_add (GTK_CONTAINER (window), hbox);

GtkWindow is a GtkBin, e.g. it can have exactly one child.


Florian

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


Re: can anybody help me figure out why the two hbox buttons don't show?

2011-12-13 Thread Florian Müllner
On mar, 2011-12-13 at 16:40 -0800, Gary Kline wrote:
 hm.  okay, so i removed the second gtk_container_box and got the
 same results.  the following hbox is missing from the window:
 
 
 
 button_dec = gtk_button_new_from_stock (Decrease counter);
 gtk_box_pack_start (GTK_BOX (hbox), button_dec, FALSE, FALSE, 2);
 g_signal_connect (button_dec, clicked, G_CALLBACK (dec_button_click_cb),
   NULL);
 gtk_widget_set_sensitive (button_dec, FALSE);
 gtk_widget_show(button_dec);
 
 in fact, neither button is displayed.


Did you add 'hbox' to any container ('vbox' in your code example)?

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


Re: can anybody help me figure out why the two hbox buttons don't show?

2011-12-13 Thread Florian Müllner
On mar, 2011-12-13 at 17:23 -0800, Gary Kline wrote:
 On Wed, Dec 14, 2011 at 02:03:21AM +0100, Florian M?llner wrote:
  Did you add 'hbox' to any container ('vbox' in your code example)?
 
 nope.

What I meant to say is: you need to add 'hbox' somewhere in the widget
hierarchy. Add it to 'vbox'.

Florian

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


Re: GList empty after iteration?

2011-09-12 Thread Florian Müllner
On lun, 2011-09-12 at 15:10 -0400, Craig wrote:
 I am shocked to see that after I iterate through the GList, I cannot
 iterate through the list again.

That's an easy one :-)


   while(events)
   {
   /* [...] */
   events = g_list_next(events);   
   }

You are modifying the list in the loop until g_list_next() returns
NULL ...


   /// this is where the list appears to be empty
   events = g_list_first(events);

so you are now trying to iterate over an empty list (events == NULL).
You probably want a dedicated variable for the iteration, e.g.

GList *iter;

events = g_list_reverse (events);
for (iter = events; iter; iter = iter-next)
  /* do stuff */;

for (iter = events; iter; iter = iter-next)
  /* do other stuff */;


Regards,
Florian

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


Re: Hidden directories (Windows)

2011-08-31 Thread Florian Müllner
On mié, 2011-08-31 at 12:30 +0100, John Emmas wrote:
 2)  When I'm creating a new directory using g_mkdir_with_parents() I've
 tended to specify 0775 for the mode flags - simply because that's what
 I've seen in every example.  But presumably there's a range of flags to
 choose from.  Is there a list available anywhere?

It is a bitmask, see chmod(2).

Florian

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

Re: Append to list store doesn't get all column attributes

2011-07-27 Thread Florian Müllner
Hey,

2011/7/28 James jamesstew...@optusnet.com.au

 In a dialog with a scrolled window displaying a list, with one column in
 the view, where the cells are editable;




 gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (view),
-1,
Name,
renderer,
text, 0,
editable, TRUE,
NULL);



This links the text (content) attribute of the tree view column to the
first column of the model, and the editable attribute to the second one
(TRUE == 1).


A button in the dialog allows the user to add to the list with;

 gtk_list_store_append(store, iter);
 gtk_list_store_set(store, iter,
0, New,
1, 0,
-1);


Here you add a row with (New, 0) to the list - whatever the intention of
the second column, the tree view will use it to determine whether the cell
should be editable, and given that 0 == FALSE, it won't be :-)

If you want all cells to be editable, the easiest way is to call

  g_object_set (renderer, editable, TRUE, NULL);

when setting up the tree view (assuming that you are using a
GtkCellRendererText). Of course, changing the gtk_list_store_set() call to
set the second column to TRUE would work as well ...


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


Re: cannot launch project with glad file

2011-01-14 Thread Florian Müllner
On Fri, 2011-01-14 at 04:36 -0500, craigbakalian wrote:
   xml = glade_xml_new (mLilyEditor.glade, NULL, NULL);

myLilyEditor.glade does not mean in the same directory as the
executable but in the current working directory.

Usually you define a constant from your Makefile.am (e.g.
PACKAGE_DATA_DIR) and construct a full path with g_build_filename():

GladeXML *xml;
char *glade_file;

glade_file = g_build_filename (PACKAGE_DATA_DIR,
   myLilyEditor.glade,
   NULL);
xml = glade_xml_new (glade_file, NULL, NULL);
g_free (glade_file);

Also note that libglade is deprecated and should not be used in new
projects - it is highly recommended that you use GtkBuilder instead (the
glade UI editor also supports that file type)


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


Re: Errors creating GdkPixbuf

2010-09-05 Thread Florian Müllner
El dom, 05-09-2010 a las 15:10 +0100, Andrew Wood escribió:
 When it runs it spews out:
 
 (process:2153): GLib-GObject-CRITICAL **: 
 /build/buildd/glib2.0-2.24.0/gobject/gtype.c:2706: You forgot to call 
 g_type_init()

Make sure to call g_type_init() before using any GObject library.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: Accessor function for application.width ?

2010-07-13 Thread Florian Müllner
El mar, 13-07-2010 a las 06:56 +0100, N James Bridge escribió:
 It's useful to blank out a drawing area by drawing a filled rectangle
 with the same size as the window. The examples I have seen get the
 dimensions from widget-allocation.width but Devhelp says that the
 GtkAllocation structure is GSEALed. At present the method works but is
 there an accessor function to use instead? I can't find one.

I guess your GTK+ ducumentation is a little outdated then -
gtk_widget_get_allocation() shouldn't be too hard to discover ;-)

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

Re: word wrap in liststore column

2010-06-27 Thread Florian Müllner
Hi,

El dom, 27-06-2010 a las 18:19 +1000, Mick escribió:
 Thanks, a clear answer to question 1 and 1.5 answers to question 2, I
 didn't notice the gtk_tree... way ontil after I guessed how to gobject
 set it, out of interest, which is better?

Whichever looks better :-)

Seriously, calling g_object_set() for that property will result in a
call to gtk_tree_view_set_rules_hint(), so both ways are equivalent(*).
Choose whatever you consider clearer / more readable.


Florian

(*) g_object_set() has to wrap/unwrap the parameter into a GValue first,
so there's a tiny overhead - ignore that unless you call it in a
loop for say 1000 objects
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: word wrap in liststore column

2010-06-26 Thread Florian Müllner
Hi,

El dom, 27-06-2010 a las 12:25 +1000, Mick escribió:
 I know that, I have searched but not found anything that says this is
 how you set the properties of ...

... an GObject:
http://library.gnome.org/devel/gobject/stable/gobject-The-Base-Object-Type.html#g-object-set


 what I'm trying to do is set wrap-width to 60 characters and wrap-mode
 to word somewhat like this:
 
 GtkSomeObscureFunction(list-action, wrap-width = 60, 
   wrap-mode = PANGO_WRAP_WORD);

So GtkSomeObscureFunction becomes:

g_object_set (G_OBJECT (cell_renderer),
  wrap-width, 60,
  wrap-mode, PANGO_WRAP_WORD,
  NULL);


 I also wish to set alternate rows backgrounds to white or pale blue,
 how is this done?

To enable different background colors for alternate rows, set the
rules-hint property of the view to TRUE:

gtk_tree_view_set_rules_hint (view, TRUE);

This will leave the color choices to the theme, which is generally what
you want.


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

Re: word wrap in liststore column

2010-06-26 Thread Florian Müllner
El sáb, 26-06-2010 a las 20:35 -0700, Steve Harrington escribió:
 This is a frustration I sometimes encounter.  How do you know to do 
 this?  I see nothing in the documentation for GtkCellRenderer or any of 
 it's antecedents that shows wrap-width or wrap-mode as a property.

That's because both are properties of GtkCellRendererText - you just
went looking in the wrong direction of the hierarchy :)


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

Re: g_io_scheduler_job_send_to_mainloop How to?

2010-06-26 Thread Florian Müllner
Hi,

the code you posted looks a little incomplete, but nevertheless I think
you got it a little backwards. From what I see, it should look more or
less like this (note: I didn't actually try to compile this):

gboolean
build_thumbnails (gpointer user_data)
{
  printf (BUILD!);
}

gboolean
job_func (GIOSchedulerJob *job,
  GCancellable*cancellable,
  gpointer user_data)
{
  g_io_scheduler_job_send_to_mainloop (job,
   build_thumbnails,
   user_data,
   NULL);
}

void
loading ()
{
  g_io_scheduler_push_job (job_func,
   (gpointer)params,
   free_params,
   G_PRIORITY_DEFAULT,
   NULL);
}

---
Florian
___
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 destroy GFile objects?

2010-06-13 Thread Florian Müllner
El dom, 13-06-2010 a las 20:27 +0200, Tomasz Jankowski escribió:
 What should I do with GFile objects (GFile *) ? What are they, regular
 GObject objects which I can destroy using g_object_unref() or maybe they're
 managed internally by GIO?

GFile is an interface which is implemented by various classes in GIO -
all of them are normal objects, so yes, g_object_unref() is the way to
go ...
___
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 get a widget from its parent of parent(...) by name?

2010-06-09 Thread Florian Müllner
El mié, 09-06-2010 a las 22:02 +1000, Tao Wang escribió:
 How can I do this if I migrate to GtkBuilder? There is no similar function
 of 'glade_xml_get_widget()'.

gtk_builder_get_object() is what you want :)
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: safely emit signal to main loop (main thread) from worker thread

2010-01-28 Thread Florian Müllner
El jue, 28-01-2010 a las 17:09 -0500, ferar achkar escribió:
 How can I safely emit a custom signal from a working thread to gtk main
 loop (main thread) to execute a custom call back function connected to
 that custom signal.

Not sure if I understand your intention here. In GObject/GTK+, signals
are tied to objects and are emitted, not sent - meaning that the
object does not have any knowledge where (or if) and by whom the signal
is handled. Really, it's pretty much like radio which is broadcasted so
you may tune in (or not), not sent specifically to your receiver.

If all you want is executing some function in the main thread, you maybe
the g_timeout/g_idle functions provide what you're looking for.

With that having said, it is always a good idea to provide some stripped
down source code.

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

Re: gtk_container_remove() and pack later again

2010-01-22 Thread Florian Müllner
On Fri, 2010-01-22 at 15:13 +0100, fka...@googlemail.com wrote:
 So, could anyone please confirm if this is correctly coded:

Well, first of all I don't think g_object_force_floating() is intended
for general application use. Beside that, the code looks overly
complicated. Why not do:

(0) Object creation / adding to container

child = gtk_some_widget_new (some_params);
g_object_ref_sink (G_OBJECT (child);
gtk_container_add (GTK_CONTAINER (container), child);


 (1) To remove a child for possible later usage I do:

 gtk_container_remove(
   GTK_CONTAINER(container),GTK_WIDGET(child));


 (2) To later re-pack the child

 gtk_box_pack_start/end(
   GTK_BOX(container), child, ...);


 (3) Before the child is destroyed (app closed) I do: */

 g_object_unref( G_OBJECT(child) );


Some explanations:
(0)
  - child is initially created with a floating reference.
  - we take ownership of the floating reference
  - gtk_container_add() calls g_object_ref_sink internally - as
child no longer is floating, this behaves like g_object_ref()
 [side node: the calls to g_object_ref_sink() and gtk_container_add()
 can be in reverse order as well]

(1)
  - we just remove child from the container - this decreases the
ref_count back to 1 (the reference we hold with child)

(2)
  - we (re)add the widget to the container - this increments the
ref_count of child, so it's back to 2

(3)
  - we call g_object_unref, which decreases the ref_count once
again; when the container is destroyed, g_object_unref() is
called on child, so ref_count drops to 0

There's really no use in trying to keep the ref_count at 1 - after all,
it just boils down to some integer in a struct. As long as you call
g_object_unref() for every reference you hold, you are fine.

Hope that clears things up a little - happy hacking!
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: gtk_builder_add_from_file error handling

2010-01-13 Thread Florian Müllner
On Wed, 2010-01-13 at 11:52 +0100, Gabriele Greco wrote:
 GError *err = NULL;
 if (!gtk_builder_add_from_file(builder_, myfile.xml, err)) {
if (err) {
   cerr  builder load fail:   err-message  '\n';
   g_free(err); // commenting this solves the crash but other gtk apis
   // and examples I've found always free error handling
 pointers

I don't know gtkmm, but at least in C GErrors are freed with
g_error_free(err).
___
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 catch window manager close

2010-01-08 Thread Florian Müllner
El vie, 08-01-2010 a las 10:43 -0500, Chris Bare escribió:
 I'm creating an app with glade, and I've got a GtkAboutDialog. my About menu
 item's activate singal calls gtk_widget_show which works as expected.

Using gtk_dialog_run() instead of gtk_widget_show() will do what you
want without connecting to delete-event.

IMHO gtk_show_about_dialog() is the most convenient way of constructing
and showing the dialog, but it's out if you insist on filling the dialog
properties in glade ...
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: callback function difference

2009-12-10 Thread Florian Müllner
El jue, 10-12-2009 a las 22:05 +0800, Zhangwei escribió:
 hello
 i'm new in gtk
 i'm puzzled about the callback functions:  g_callback()  gtk_signal_func()
 they looked same
 is there anyone can tell me the difference ?

There is none. The object/signal system of Gtk was split out into
GObject a long time ago, but part of the old system is still in Gtk for
compatibility reasons.
So while gtk_signal_func is a mere alias for g_callback, the former must
not be used in newly written code - in fact, it will be removed with the
release of Gtk+-3.0.

Regards,
Florian

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

Re: Re: Application termination at some point

2009-11-17 Thread Florian Müllner
On mar, 2009-11-17 at 10:47 +, ds.sun...@gmail.com wrote:
 Thank you very much for your replies guys...
 
 I run my test application with -g option and i am getting the following  
 error message. I not able to fix the issue with the available information.  
 Am i doing things correctly or not? Is this the one you want me to do?

I'm not sure that you got that right - the -g option is a compiler flag
to include debugging symbols, _not_ an application option (unless of
course, your application has such a (completely unrelated) option). You
will have to modify your build files to include it (e.g. AM_CFLAGS if
using automake) and rebuild the application.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: g_object_get_data Programmer error

2009-11-03 Thread Florian Müllner
El mar, 03-11-2009 a las 07:39 -0800, Steve Harrington escribió:
 I am trying to use g_object_get_data() to retrieve the GtkWidget * of an 
 object.  Seems simple enough but The attached code doesn't work.  I must 
 have missed something simple but darned if I can see it.

Indeed - g_object_get_data retrieves data explicitly set on an object
with g_object_set_data. No call to the latter in your code ...

Use something like the following snippet to make it work:

 Main = GTK_WIDGET( gtk_builder_get_object(builder, Main) );

g_object_set_data( G_OBJECT(Main),
   Button,
   gtk_builder_get_object(builder, Button) );

 gtk_builder_connect_signals( builder, NULL );
 g_object_unref( G_OBJECT(builder) );
 gtk_widget_show_all( Main );
 gtk_main( );


Another annotation just in case:

 void GTKButtonCB( GtkWidget *widget, gpointer data )
 {
 GtkWidget  *W;
 
 
 if( (W = g_object_get_data(G_OBJECT(Main), Button)) != NULL )
  {
GtkWidget *dialog;
dialog = gtk_message_dialog_new( NULL,
 GTK_DIALOG_DESTROY_WITH_PARENT,
 GTK_MESSAGE_ERROR,
 GTK_BUTTONS_CLOSE,
 %s,
 GTKButtonCB );
gtk_message_dialog_format_secondary_text( GTK_MESSAGE_DIALOG(dialog),
  Found \Button\ widget%s,
  W == widget ? , which is passed as callback
parameter
  : );

gtk_dialog_run( GTK_DIALOG(dialog) );
gtk_widget_destroy( dialog );
  }

So in case of the example, g_object_get_data is not necessary, as the
button widget is directly available to the callback handler.

Hope the above snippets are helpful.

Happy hacking,
Florian

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

Re: toolbutton label not visible in gtk 2.18

2009-10-30 Thread Florian Müllner
On Fri, 2009-10-30 at 09:57 -0700, John Stebbins wrote:
 On 10/30/2009 09:24 AM, John Stebbins wrote:
  I just installed fedora 12 beta on one machine and ubuntu 9.10 on 
  another.  Both have gtk 2.18.3.  When I run my application on either 
  system, my toolbutton labels are not visible.  Am I missing some new 
  property that needs to be set to make them visible, or is this a gtk bug?
 
 I figured it out.  The GtkToolBar property toolbar-sytle now must be set 
 to GTK_TOOLBAR_BOTH.  This wasn't necessary before.  I don't know if it 
 makes a difference, but my ui is being initialized with GtkBuilder.
 

I don't think this is the preferred way - the toolbar style is a user
setting which should be respected if possible.
Until recently, the default style was to show labels below icons. This
was changed with the release of Gnome 2.28 to show labels beside icons
_only_ for actions with the is_important property set to TRUE.
So IMHO the correct way of doing it would be to pick the most
important actions and mark them with gtk_action_set_is_important.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list