#define GLADE_HOOKUP_OBJECT( component,widget,name ) \
g_object_set_data_full( G_OBJECT( component ), name, \
- g_object_ref( widget ), (GDestroyNotify) g_object_unref )
+ g_object_ref( (void *) widget ), (GDestroyNotify) g_object_unref )
#define GLADE_HOOKUP_OBJECT_NO_REF( component,widget,name ) \
- g_object_set_data( G_OBJECT( component ), name, widget )
+ g_object_set_data( G_OBJECT( component ), name, (void *) widget )
// created by glade
GtkWidget*
// list store
ui::ListStore ignorelist = ui::ListStore(gtk_list_store_new( 1, G_TYPE_STRING ));
gtk_tree_view_set_model( GTK_TREE_VIEW( lookup_widget( wnd, "t_materialist" ) ), GTK_TREE_MODEL( ignorelist ) );
- g_object_unref( ignorelist );
+ ignorelist.unref();
gtk_widget_show_all( wnd );
g_brushexp_window = wnd;
gtk_box_pack_start( GTK_BOX( vbox ), label, FALSE, FALSE, 2 ); // insert the label in the box
button = ui::Button( "OK" ); // create a button with text
- g_signal_connect_swapped( G_OBJECT( button ), "clicked", G_CALLBACK( gtk_widget_destroy ), window ); // connect the click event to close the window
+ g_signal_connect_swapped( G_OBJECT( button ), "clicked", G_CALLBACK( gtk_widget_destroy ), (void *) window ); // connect the click event to close the window
gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 2 ); // insert the button in the box
gtk_window_set_position( GTK_WINDOW( window ), GTK_WIN_POS_CENTER ); // center the window on screen
GLWidget_sharedContextDestroyed();
- g_object_unref( g_shared );
+ g_shared.unref();
g_shared = ui::Widget(nullptr);
}
return FALSE;
explicit operator void *() const
{ return _handle; }
+ void unref()
+ { g_object_unref(_handle); }
+
template<class Lambda>
gulong connect(char const *detailed_signal, Lambda &&c_handler, void *data);
+
+ template<class Lambda>
+ gulong connect(char const *detailed_signal, Lambda &&c_handler, Object data);
};
static_assert(sizeof(Object) == sizeof(Object::native), "object slicing");
return g_signal_connect(G_OBJECT(this), detailed_signal, c_handler, data);
}
+ template<class Lambda>
+ gulong Object::connect(char const *detailed_signal, Lambda &&c_handler, Object data)
+ {
+ return g_signal_connect(G_OBJECT(this), detailed_signal, c_handler, (_GtkObject *) data);
+ }
+
template<class Lambda>
void IContainer::foreach(Lambda &&lambda)
{
view.connect( "key_press_event", G_CALLBACK( project_key_press ), &projectList );
- g_object_unref( G_OBJECT( store ) );
+ store.unref();
}
}
}
scr.add(view);
- g_object_unref( G_OBJECT( store ) );
+ store.unref();
view.connect( "key_press_event", G_CALLBACK( commands_key_press ), store );
g_signal_handler_disconnect( G_OBJECT( m_gl_widget ), m_sizeHandler );
g_signal_handler_disconnect( G_OBJECT( m_gl_widget ), m_exposeHandler );
- g_object_unref( m_gl_widget );
+ m_gl_widget.unref();
m_window_observer->release();
}
GlobalShortcuts_foreach( visitor );
}
- g_object_unref( G_OBJECT( store ) );
+ store.unref();
}
}
gtk_table_attach( g_spawnflagsTable, widget, i % 4, i % 4 + 1, i / 4, i / 4 + 1,
(GtkAttachOptions)( GTK_FILL ),
(GtkAttachOptions)( GTK_FILL ), 0, 0 );
- g_object_unref( widget );
+ widget.unref();
gtk_label_set_text( GTK_LABEL( gtk_bin_get_child(GTK_BIN(widget)) ), str.c_str() );
}
scr.add(view);
- g_object_unref( G_OBJECT( store ) );
+ store.unref();
g_entityClassList = view;
g_entlist_store = store;
}
scr.add(view);
- g_object_unref( G_OBJECT( store ) );
+ store.unref();
g_entprops_store = store;
}
scr.add(view);
- g_object_unref( G_OBJECT( store ) );
+ store.unref();
m_clist = store;
}
}
}
- g_object_unref( G_OBJECT( EntityBreakdownWalker ) );
+ EntityBreakdownWalker.unref();
char tmp[16];
sprintf( tmp, "%u", Unsigned( g_brushCount.get() ) );
(GtkAttachOptions)( GTK_FILL ),
(GtkAttachOptions)( 0 ), 0, 0 );
gtk_widget_set_size_request( GTK_WIDGET( entry ), 50, -1 );
- g_object_set_data( G_OBJECT( window ), "hshift_entry", entry );
+ g_object_set_data( G_OBJECT( window ), "hshift_entry", (void *) entry );
// we fill in this data, if no patch is selected the widgets are unmodified when the inspector is raised
// so we need to have at least one initialisation somewhere
entry_set_float( entry, g_pi_globals.shift[0] );
{
- GtkTreeStore* store = gtk_tree_store_new( 2, G_TYPE_STRING, G_TYPE_POINTER );
+ auto store = gtk_tree_store_new( 2, G_TYPE_STRING, G_TYPE_POINTER );
ui::Widget view = ui::TreeView(ui::TreeModel( GTK_TREE_MODEL( store ) ));
gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( view ), FALSE );
#include <gtk/gtk.h>
-template
-class EntryCompletion<TextureNameList>;
-
-template
-class EntryCompletion<ShaderList>;
-
template<class StringList>
void EntryCompletion<StringList>::connect(ui::Entry entry)
{
clear();
fill();
}
+
+template
+class EntryCompletion<TextureNameList>;
+
+template
+class EntryCompletion<ShaderList>;
void append(const char *string);
- typedef MemberCaller1<EntryCompletion, const char *, &EntryCompletion::append> AppendCaller;
+ using AppendCaller = MemberCaller1<EntryCompletion, const char *, &EntryCompletion::append>;
void fill();
void update();
- typedef MemberCaller<EntryCompletion, &EntryCompletion::update> UpdateCaller;
+ using UpdateCaller = MemberCaller<EntryCompletion, &EntryCompletion::update>;
};
class TextureNameList {
auto renderer = ui::CellRendererText();
g_TextureBrowser.m_assigned_tree = ui::TreeView(ui::TreeModel( GTK_TREE_MODEL( g_TextureBrowser.m_assigned_store ) ));
- g_object_unref( G_OBJECT( g_TextureBrowser.m_assigned_store ) );
+ g_TextureBrowser.m_assigned_store.unref();
g_TextureBrowser.m_assigned_tree.connect( "row-activated", (GCallback) TextureBrowser_removeTags, NULL );
gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( g_TextureBrowser.m_assigned_tree ), FALSE );
auto renderer = ui::CellRendererText();
g_TextureBrowser.m_available_tree = ui::TreeView(ui::TreeModel( GTK_TREE_MODEL( g_TextureBrowser.m_available_store ) ));
- g_object_unref( G_OBJECT( g_TextureBrowser.m_available_store ) );
+ g_TextureBrowser.m_available_store.unref();
g_TextureBrowser.m_available_tree.connect( "row-activated", (GCallback) TextureBrowser_assignTags, NULL );
gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( g_TextureBrowser.m_available_tree ), FALSE );
g_signal_handler_disconnect( G_OBJECT( g_TextureBrowser.m_gl_widget ), g_TextureBrowser.m_sizeHandler );
g_signal_handler_disconnect( G_OBJECT( g_TextureBrowser.m_gl_widget ), g_TextureBrowser.m_exposeHandler );
- g_object_unref( g_TextureBrowser.m_gl_widget );
+ g_TextureBrowser.m_gl_widget.unref();
}
const Vector3& TextureBrowser_getBackgroundColour( TextureBrowser& textureBrowser ){
g_signal_handler_disconnect( G_OBJECT( m_gl_widget ), m_sizeHandler );
g_signal_handler_disconnect( G_OBJECT( m_gl_widget ), m_exposeHandler );
- g_object_unref( m_gl_widget );
+ m_gl_widget.unref();
m_window_observer->release();
}