Commit graph

739 commits

Author SHA1 Message Date
Gankov Andrey 1da92bdd62 gtk: Add ListStore.SetValue overload for long type
Without that change, using ListStore.SetValue with a long would use the
float overload, which might not be expected and cause some issues.

Signed-off-by: Bertrand Lorentz <bertrand.lorentz@gmail.com>
2014-04-21 16:50:21 +02:00
Stephan Sundermann a74534e835 generator: Create a directory for each namespace
When dealing with several namespaces there might be classes with the same name
(especially Global which is autogenerated in g-i based bindings). On generation
the file would be overriden by the last occurence in the xml. To encounter
this every namespace has it's own directory now. This also improves structure
a lot when dealing with big libraries.

Also do the necessary adaption for the build and the csproj files.
2014-03-01 21:16:54 +01:00
Bertrand Lorentz 49295c119b build: Only build gui-thread-check profiler module on mono
The profiler module will only work with mono, so we don't need to build
it on Windows with the .Net framework.
2014-02-23 16:18:28 +01:00
Bertrand Lorentz 691de4e606 gtk: Fix dll name and use a const for all DllImports in custom code
In Windows builds of GTK+ 3.x, the dll filename is libgtk-3-0.dll.

We use this opportunity to use a common const in the DllImport
statement for all custom code.
2014-02-23 15:12:20 +01:00
Bertrand Lorentz 32d10bd319 Use GLib.Marshaller.Free instead of calling g_free directly
Using the GLib.Marshaller.Free method means we don't need to have the
g_free function definition duplicated all over the place.
2013-11-17 16:20:02 +01:00
Bertrand Lorentz d6f06860fb Merge pull request #90 from knocte/embedded
gtk: fix Application to be more robust when embedding mono
2013-11-09 08:10:06 -08:00
Andrés G. Aragoneses 2967482762 Revert "gtk: Mark the Cairo.Context in Widget.Drawn as owned"
This reverts commit 21bfaa7a9d.

After fixing the memory leak when finalizing a Context object in the
previous commit, native crashes would happen when using a Gtk#-based
app. The reason is that this commit tried to fix the leak with the wrong
approach of marking the CairoContext as owned. This avoided the leak by
not incrementing the reference count, but now that the leak is fixed,
cairo_destroy is called one time too much.

The CairoContext passed in the Draw signal is not marked as
transfer-ownership=full in GObject-Introspection metadata. So unmarking
this as owned fixes the "potential double-free" assertion that was
causing the crash.
2013-11-03 17:01:34 +01:00
Andrés G. Aragoneses 53e884dd22 gtk: fix Application to be more robust when embedding mono
When embedding mono, Environment.GetCommandLineArgs() would not return
an array with any element.

Reported in the mailing list, by Vardar Sahin.
2013-11-03 16:11:42 +01:00
Bertrand Lorentz fc9746013d gtk: Fix TreeView.GetTooltipContext method signature (bxc#14678)
The x and y parameters of gtk_tree_view_get_tooltip_context() are marked
as inout in the Gtk+ docs, so we need to mark them as ref.
2013-11-03 14:42:39 +01:00
Andrés G. Aragoneses 10546e2ffa MSBuild: fix the solution build (except audit and sample projects)
This commit makes it possible to build any project of the gtk-sharp.sln
from an IDE (except audit and sample projects, which require a bit more
work).

This doesn't mean that autotools is deprecated, but just that it is more
comfortable to use an IDE when working on gtk-sharp because it will
offer better auto-completion, and will stop highlight misleading
semantic errors, from now on.
2013-11-02 15:48:58 +01:00
Andrés G. Aragoneses 7dafb39c01 gui-thread-check: add two more methods to the whitelist
At application shutdown, it's very likely to be spammed by
gui-thread-check with a river of:

*** GTK CALL NOT IN GUI THREAD: Widget.Dispose
*** GTK CALL NOT IN GUI THREAD: Widget.remove_InternalDestroyed
*** GTK CALL NOT IN GUI THREAD: Widget.Dispose
*** GTK CALL NOT IN GUI THREAD: Widget.remove_InternalDestroyed
...

From what I gather, these two methods (in gtk-sharp master[1]) could
be called by the finalizers, but do not call any unmanaged functions,
so it should be ok to not report them as violations.

[1] https://github.com/mono/gtk-sharp/blob/master/gtk/Widget.cs

Cherry-picked from 77a40599ca
2013-10-31 10:18:02 +01:00
Andrés G. Aragoneses dcc2850a39 gui-thread-check: use fflush() after printf()
Using fflush() right away after printf() calls avoids the buffers to
be written in an apparently complete-out-of-sync way from the point
of view of the developer. This problem would specially occur when
redirecting all output to a file this way:

  mono Foo.exe > out.txt 2>&1

Without this fix, all the output from gui-thread-check would appear
at the end of the file, instead of in between the output generated by
the program.

Cherry-picked from 6988cd4cd2
2013-10-28 21:57:29 +01:00
Andrés G. Aragoneses 5ce4e63bd9 gtk: reference Cairo in MSBuild csproj 2013-10-22 12:33:24 +02:00
Bertrand Lorentz b2fb84d14b Clean up .gitignore files 2013-10-13 18:38:33 +02:00
Bertrand Lorentz 5f8e0953cf gtk: Use native function for GtkTextIter.Equals(GtkTextIter)
As GtkTextIter has no public properties, the default generated Equals
implementation would be "return true;". We now suppress that and with a
fix-up now use the native gtk_text_iter_equal to implement the Equals
method.
2013-10-10 16:28:37 +02:00
Andrés G. Aragoneses 7ce1457c13 gtk: Fix a KeyNotFoundException regression in Destroyed event
The migration to generic collections [1] caused another regression: a
KeyNotFoundException was being thrown (instead of returning null like
HashTable did) when using the Destroyed event of the Gtk.Widget class.

[1] 6850b343ca

A particular example of this problem is Banshee's Import Media feature,
which was generating the following stacktrace:

[1 Debug 23:24:36.898] Starting - Importing Media
Marshaling activate signal
Exception in Gtk# callback delegate
  Note: Applications can use GLib.ExceptionManager.UnhandledException
to handle the exception.
System.Reflection.TargetInvocationException: Exception has been thrown
by the target of an invocation. --->
System.Collections.Generic.KeyNotFoundException: The given key was not
present in the dictionary.
  at System.Collections.Generic.Dictionary`2[System.IntPtr,System.Delegate].get_Item
(IntPtr key) [0x00000] in <filename unknown>:0
  at Gtk.Widget.add_Destroyed (System.EventHandler value) [0x00000] in
/home/knocte/gtk-sharp/gtk/Widget.cs:333
  at Hyena.Widgets.AnimatedWidget..ctor (Gtk.Widget widget, UInt32
duration, Easing easing, Blocking blocking, Boolean horizontal)
[0x0004d] in /home/knocte/banshee/src/Hyena/Hyena.Gui/Hyena.Widgets/AnimatedWidget.cs:78
2013-09-24 18:58:33 +02:00
Andrés G. Aragoneses 9016c304de MSBuild: change some projects to Library type, not Executable
Even though gtk-sharp cannot be built via MSBuild (yet?), it's better
to make the .csproj reflect more closely what you get with the normal
build.
2013-09-24 01:24:33 +02:00
Andrés G. Aragoneses 74b6340d86 MSBuild: update some project files to account for recent changes 2013-08-23 23:56:23 +02:00
Jeffrey Stedfast d3c1826c37 gtk: Handle a null Gdk.Event passed to CellRenderer.StartEditing()
Cherry-picked from the gtk-sharp-2.12 branch.
2013-08-18 18:32:21 +02:00
Andres G. Aragoneses 2e56a23e9f gtk: Track API changes (I- interface prefixes)
This includes changes to fix the build, and changes to custom code that
gets added to the generated code. I.e. TreeModel now becomes ITreeModel
2013-07-23 12:05:24 -05:00
Bertrand Lorentz 214532f684 Merge pull request #62 from knocte/automake_warnings
build: fix automake warning about preprocessor C flags
2013-07-23 09:37:18 -07:00
Andrés G. Aragoneses 10d3293d3f build: fix automake warning about preprocessor C flags
With automake version 1.13.2 (which comes in debian testing/jessie),
we were starting to get these warnings by default:

...
Running automake --foreign  ...
atk/glue/Makefile.am:16: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
gio/glue/Makefile.am:11: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
gtk/glue/Makefile.am:18: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
gtk/gui-thread-check/profiler/Makefile.am:8: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
pango/glue/Makefile.am:13: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
sample/opaquetest/Makefile.am:18: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
sample/valtest/Makefile.am:18: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
Running autoconf ...
...

We simply follow the warning's recommendation of using AM_CPPFLAGS instead
(CPP meaning C PreProcessor, not C Plus Plus), as explained in
http://www.gnu.org/software/automake/manual/html_node/Program-Variables.html

The deprecation of INCLUDES has been very long there already (since 2002,
therefore Automake 1.7), and we already depend on automake 1.10.
2013-06-17 10:59:28 +02:00
Bertrand Lorentz 2d34ed8351 gtk: Remove unused P/Invoke in IconTheme
Now that it uses the Marshaller, IconTheme doesn't call g_strfreev
directly anymore.
2013-04-21 16:39:52 +02:00
Bertrand Lorentz 7160437532 gtk: Remove invalid FileChooserDialog constructor
The ..._new_with_backend native function has been removed, so the
corresponding constructor must be removed.
2013-04-21 16:19:10 +02:00
Bertrand Lorentz f14eee3eb6 gtk: Fixup AccelMap.LookupEntry to have key as an out param (bxc#11367) 2013-04-21 14:39:18 +02:00
Bertrand Lorentz eb5e9c7b74 gtk: Remove TreeViewColumn.CellRenderers property (bxc#8593)
The corresponding native function is gone in GTK 3, replaced by
gtk_cell_layout_get_cells.
2013-04-21 13:50:48 +02:00
Bertrand Lorentz 253da2e05c Remove obsolete fix-ups for needs_ref attribute
The needs_ref attribute hasn't been used by the generator for quite some
time now.
2013-02-23 13:41:50 +01:00
Bertrand Lorentz 91474fe1f1 gtk: Mark the whole Style class as obsolete 2012-11-18 15:55:03 +01:00
Bertrand Lorentz 761cb09260 gui-thread-check: Replace COPYING with the correct license
As indicated in the source code, and confirmed by the original author,
the gui-thread-check is licensed under the GPL v2.
2012-11-15 21:14:45 +01:00
Bertrand Lorentz 3b37e81b05 gtk: Fix-ups to set the scope of a few callbacks 2012-11-15 18:18:37 +01:00
Bertrand Lorentz 3cce546661 gtk: Fix return types for IterList* methods in WidgetPath 2012-11-15 14:07:35 +01:00
Bertrand Lorentz 6809865526 gtk: Make the Group property for Radio* widgets a properly typed array
The Group property for all the Radio* classes (RadioAction, RadioButton,
RadioMenuItem and RadioToolButton) was exposed as a GLib.SList,
with its elements untyped.

We now hide the various Group properties and have custom code to handle
them correctly.
2012-11-15 12:05:45 +01:00
Bertrand Lorentz d8aa4ab275 gtk: Fix-up return type for some methods returning lists 2012-11-15 11:58:18 +01:00
Rickard Edström 8e07e7d225 Add a SynchronizationContext implementation for GLib (bnc#621444)
Create a GLibSynchronizationContext that sends code to be run on the
GLib main loop, and set it as the current SynchronizationContext in
Gtk.Init().

When you use the await keyword to do a task asynchronously, by default
the awaiter will capture the current SynchronizationContext, and if
there was one, when the task completes it’ll Post the supplied
continuation back to that context, rather than running it on whatever
thread it wants.

This means that if you use the async/await keywords in your Gtk# app,
things will now work as expected with the GTK main thread. For example:

static async void DoWork () // called in the GTK main thread
{
    // Do some stuff with the UI...
    label.Text = "Starting Work";

    // Run something asynchronously, UI is not frozen
    int res = await DoLongOperation ();

    // Do some more UI stuff, it'll run on the GTK main thread
    label.Text = "Work done";
}

Signed-off-by: Bertrand Lorentz <bertrand.lorentz@gmail.com>
2012-11-08 22:33:46 +01:00
Bertrand Lorentz 2edff869fd gui-thread-check: Fix some compilation warnings 2012-11-04 18:16:22 +01:00
Bertrand Lorentz bd41e1150d Add the gui-thread-check profiler module by Lluis Sanchez
This is a mono profiler module that can be used to detect when GTK or
GDK methods are called from a thread which is not the main GUI thread.

Thanks to Andrés Aragoneses for doing the work to bring this into Gtk#.
2012-11-04 18:00:56 +01:00
Bertrand Lorentz 6850b343ca gtk: Switch to generic collections in some classes 2012-11-04 16:58:50 +01:00
Andres G. Aragoneses 38e920996a gui-thread-check: Remove stock INSTALL file
It didn't contain any gui-thread-check's specifics.
2012-11-04 00:43:08 +00:00
Andres G. Aragoneses 3af6df2a2c gui-thread-check: Remove NEWS file (it was empty) 2012-11-04 00:42:22 +00:00
Andres G. Aragoneses d58243149d gui-thread-check: Merge README with gtk-sharp's 2012-11-04 00:42:01 +00:00
Andres G. Aragoneses 0ed390b201 gui-thread-check: Remove AUTHORS
Lluis is already included in AUTHORS file of gtk-sharp.
2012-11-04 00:41:20 +00:00
Andres G. Aragoneses 38770b8917 gui-thread-check: Merge config/build infrastructure with gtk-sharp 2012-11-04 00:32:09 +00:00
Andres G. Aragoneses ab447d924a gui-thread-check: Remove bogus Makefile.in
This is regenerate at every build (from Makefile.am) so
there's no need to store it in the repo. It must have been
included by mistake during the move.
2012-11-04 00:27:00 +00:00
Andres G. Aragoneses 797382180b Moved gui-thread-check subfolder inside gtk subfolder.
It's just really a profiler module facility for GTK, so it's not
related to the rest of the libraries/APIs that are not GTK and live
here.
2012-11-03 23:06:02 +00:00
Bertrand Lorentz c312fb739c gtk: Move interface declaration from fix-up to custom code
As we now use partial classes for custom code, we can put additional
interface implementation declaration in the custom code, instead of
adding it through a fix-up.

Side-note: I thought about moving to IEnumerable<T>, but ListStore is a
list of objects anyway, and Container is an array of Widgets, so there
wouldn't be much benefit from type safety.
2012-11-03 17:50:05 +01:00
Bertrand Lorentz c3b3036441 gtk: Fix return type of RecentChooser.GetUris
The native function returns a NULL-terminated array of strings, so add
this as a fix-up.
2012-11-02 19:48:02 +01:00
Bertrand Lorentz 60612071c1 Add a MonoDevelop solution and projects for browsing the codebase
This is just to be able to use MonoDevelop to browse the codebase, both
custom and generated code. It is NOT intended to be used to build
anything.
2012-10-13 16:44:10 +02:00
Michael Hutchinson b5e0d297bb Fix resurrection cycles in container subclasses (bxc#3801) 2012-10-13 15:07:03 +02:00
Michael Hutchinson 3a044d6faf Fix stack overflow in subclasses of managed containers 2012-10-13 15:06:51 +02:00
Bertrand Lorentz 446f2e7c7a gtk: Fix a small issue in the previous commit to IconTheme
The native array has an extra NULL element, so we pass the length of the
managed array, which is the real length of the array.
2012-09-05 22:40:50 +02:00