Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
GNOME
glom
Commits
20194ff9
Commit
20194ff9
authored
Jul 05, 2013
by
Murray Cumming
Browse files
C++11: Use std::function instead of sigc::slot.
parent
00951d90
Changes
13
Hide whitespace changes
Inline
Side-by-side
glom/appwindow.cc
View file @
20194ff9
...
...
@@ -108,9 +108,9 @@ AppWindow::AppWindow(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>&
ConnectionPool
*
connection_pool
=
ConnectionPool
::
get_instance
();
if
(
!
connection_pool
)
connection_pool
->
set_avahi_publish_callbacks
(
sigc
::
mem_fun
(
*
this
,
&
AppWindow
::
on_connection_avahi_begin
),
sigc
::
mem_fun
(
*
this
,
&
AppWindow
::
on_connection_avahi_progress
),
sigc
::
mem_fun
(
*
this
,
&
AppWindow
::
on_connection_avahi_done
)
);
sigc
::
bind
(
&
AppWindow
::
on_connection_avahi_begin
,
this
),
sigc
::
bind
(
&
AppWindow
::
on_connection_avahi_progress
,
this
),
sigc
::
bind
(
&
AppWindow
::
on_connection_avahi_done
,
this
)
);
#endif
#endif // !GLOM_ENABLE_CLIENT_ONLY
...
...
@@ -1129,7 +1129,7 @@ bool AppWindow::on_document_load()
else
{
#ifndef GLOM_ENABLE_CLIENT_ONLY
connection_pool
->
set_get_document_func
(
s
igc
::
mem_fun
(
*
this
,
&
AppWindow
::
on_connection_pool_get_document
)
);
connection_pool
->
set_get_document_func
(
s
td
::
bind
(
&
AppWindow
::
on_connection_pool_get_document
,
this
)
);
#endif
connection_pool
->
set_ready_to_connect
(
true
);
//connect_to_server() will now attempt the connection-> Shared instances of m_Connection will also be usable.
...
...
@@ -1545,7 +1545,7 @@ void AppWindow::existing_or_new_new()
//Tell the connection pool about the document:
ConnectionPool
*
connection_pool
=
ConnectionPool
::
get_instance
();
if
(
connection_pool
)
connection_pool
->
set_get_document_func
(
s
igc
::
mem_fun
(
*
this
,
&
AppWindow
::
on_connection_pool_get_document
)
);
connection_pool
->
set_get_document_func
(
s
td
::
bind
(
&
AppWindow
::
on_connection_pool_get_document
,
this
)
);
const
bool
connected
=
m_pFrame
->
connection_request_password_and_choose_new_database_name
();
if
(
!
connected
)
...
...
glom/frame_glom.cc
View file @
20194ff9
...
...
@@ -2294,7 +2294,7 @@ bool Frame_Glom::create_database(const Glib::ustring& database_name, const Glib:
{
BusyCursor
busycursor
(
*
pWindowApp
);
s
igc
::
slot
<
void
>
onProgress
;
//TODO: Show visual feedback.
s
td
::
function
<
void
()
>
onProgress
;
//TODO: Show visual feedback.
result
=
DbUtils
::
create_database
(
get_document
(),
database_name
,
title
,
onProgress
);
}
...
...
glom/glom_create_from_example.cc
View file @
20194ff9
...
...
@@ -511,7 +511,7 @@ int main(int argc, char* argv[])
}
g_assert
(
started
==
Glom
::
ConnectionPool
::
Backend
::
STARTUPERROR_NONE
);
const
bool
recreated
=
Glom
::
DbUtils
::
recreate_database_from_document
(
&
document
,
sigc
::
ptr_fun
(
&
on_recreate_progress
)
)
;
const
bool
recreated
=
Glom
::
DbUtils
::
recreate_database_from_document
(
&
document
,
&
on_recreate_progress
);
if
(
!
recreated
)
cleanup
();
g_assert
(
recreated
);
...
...
glom/libglom/connectionpool.h
View file @
20194ff9
...
...
@@ -111,7 +111,7 @@ public:
/// Delete the singleton so it doesn't show up as leaked memory in, for instance, valgrind.
static
void
delete_instance
();
typedef
s
igc
::
slot
<
void
>
type_void_slot
;
typedef
s
td
::
function
<
void
()
>
type_void_slot
;
#ifndef G_OS_WIN32
/** Set callbacks that will be called to show UI while starting to advertise
...
...
@@ -283,7 +283,7 @@ public:
* This callback avoids Connection having to link to AppWindow,
* and avoids us worrying about whether a previously-set document (via a set_document() method) is still valid.
*/
typedef
s
igc
::
slot
<
Document
*>
SlotGetDocument
;
typedef
s
td
::
function
<
Document
*
()
>
SlotGetDocument
;
void
set_get_document_func
(
const
SlotGetDocument
&
slot
);
#ifndef G_OS_WIN32
...
...
glom/libglom/connectionpool_backends/backend.h
View file @
20194ff9
...
...
@@ -27,6 +27,7 @@
#include
<libglom/data_structure/field.h>
#include
<memory>
#include
<functional>
namespace
Glom
{
...
...
@@ -119,7 +120,7 @@ protected:
/** This callback should show UI to indicate that work is still happening.
* For instance, a pulsing ProgressBar.
*/
typedef
s
igc
::
slot
<
void
>
SlotProgress
;
typedef
s
td
::
function
<
void
()
>
SlotProgress
;
/** This method is called for one-time initialization of the database
* storage. There is no need to implement this function if the data is centrally
...
...
glom/libglom/db_utils.cc
View file @
20194ff9
...
...
@@ -101,7 +101,7 @@ static bool update_gda_metastore_for_table(const Glib::ustring& table_name)
return
true
;
}
bool
create_database
(
Document
*
document
,
const
Glib
::
ustring
&
database_name
,
const
Glib
::
ustring
&
title
,
const
s
igc
::
slot
<
void
>&
progress
)
bool
create_database
(
Document
*
document
,
const
Glib
::
ustring
&
database_name
,
const
Glib
::
ustring
&
title
,
const
s
td
::
function
<
void
()
>&
progress
)
{
#if 1
// This seems to increase the chance that the database creation does not
...
...
@@ -207,7 +207,7 @@ bool create_database(Document* document, const Glib::ustring& database_name, con
}
}
bool
recreate_database_from_document
(
Document
*
document
,
const
s
igc
::
slot
<
void
>&
progress
)
bool
recreate_database_from_document
(
Document
*
document
,
const
s
td
::
function
<
void
()
>&
progress
)
{
ConnectionPool
*
connection_pool
=
ConnectionPool
::
get_instance
();
if
(
!
connection_pool
)
...
...
glom/libglom/db_utils.h
View file @
20194ff9
...
...
@@ -33,13 +33,13 @@ namespace DbUtils
/**
* This also saves the connection port in the document if self-hosting.
*/
bool
create_database
(
Document
*
document
,
const
Glib
::
ustring
&
database_name
,
const
Glib
::
ustring
&
title
,
const
s
igc
::
slot
<
void
>&
progress
);
bool
create_database
(
Document
*
document
,
const
Glib
::
ustring
&
database_name
,
const
Glib
::
ustring
&
title
,
const
s
td
::
function
<
void
()
>&
progress
);
//TODO: Use this in Glom::AppWindow?
/** Create the database on an already-connected server.
* This also saves some details in the document.
*/
bool
recreate_database_from_document
(
Document
*
document
,
const
s
igc
::
slot
<
void
>&
progress
);
bool
recreate_database_from_document
(
Document
*
document
,
const
s
td
::
function
<
void
()
>&
progress
);
/** This creates the standard tables if necessary,
* filling them with some information from the document.
...
...
glom/libglom/document/document.h
View file @
20194ff9
...
...
@@ -42,6 +42,7 @@
#include
<vector>
#include
<map>
#include
<limits>
// for numeric_limits
#include
<functional>
namespace
Gtk
{
...
...
@@ -453,7 +454,7 @@ public:
/** This callback should show UI to indicate that work is still happening.
* For instance, a pulsing ProgressBar.
*/
typedef
s
igc
::
slot
<
void
>
SlotProgress
;
typedef
s
td
::
function
<
void
()
>
SlotProgress
;
/** Save a copy of the document as a backup.
* This document (and its URI) will not be changed.
...
...
glom/libglom/python_embed/py_glom_ui_callbacks.h
View file @
20194ff9
...
...
@@ -39,28 +39,28 @@ public:
/** For example,
* void on_show_table_details(const Glib::ustring& table_name, const Gnome::Gda::Value& primary_key_value);
*/
s
igc
::
slot
<
void
,
const
Glib
::
ustring
&
,
const
Gnome
::
Gda
::
Value
&>
m_slot_show_table_details
;
s
td
::
function
<
void
(
const
Glib
::
ustring
&
,
const
Gnome
::
Gda
::
Value
&
)
>
m_slot_show_table_details
;
/** For example,
* void on_show_table_list(const Glib::ustring& table_name);
*/
s
igc
::
slot
<
void
,
const
Glib
::
ustring
&>
m_slot_show_table_list
;
s
td
::
function
<
void
(
const
Glib
::
ustring
&
)
>
m_slot_show_table_list
;
/** For example,
* void on_print_report(const Glib::ustring& report_name);
*/
s
igc
::
slot
<
void
,
const
Glib
::
ustring
&>
m_slot_print_report
;
s
td
::
function
<
void
(
const
Glib
::
ustring
&
)
>
m_slot_print_report
;
/** For example,
* void on_print_layout();
*/
s
igc
::
slot
<
void
>
m_slot_print_layout
;
s
td
::
function
<
void
()
>
m_slot_print_layout
;
/** For example,
* void on_start_new_record();
* Use an empty Value for auto-created fields.
*/
s
igc
::
slot
<
void
>
m_slot_start_new_record
;
s
td
::
function
<
void
()
>
m_slot_start_new_record
;
};
}
//namespace Glom
...
...
glom/libglom/spawn_with_feedback.h
View file @
20194ff9
...
...
@@ -22,7 +22,7 @@
#define GLOM_SPAWN_WITH_FEEDBACK_H
#include
<glibmm/ustring.h>
#include
<
sigc++/sigc++.h
>
#include
<
functional
>
namespace
Glom
{
...
...
@@ -33,7 +33,7 @@ namespace Spawn
/** This callback should show UI to indicate that work is still happening.
* For instance, a pulsing ProgressBar.
*/
typedef
s
igc
::
slot
<
void
>
SlotProgress
;
typedef
s
td
::
function
<
void
()
>
SlotProgress
;
/** Execute a command-line command, and wait for it to return.
* @param command The command-line command.
...
...
glom/python_embed/python_ui_callbacks.cc
View file @
20194ff9
...
...
@@ -27,15 +27,15 @@ namespace Glom
AppPythonUICallbacks
::
AppPythonUICallbacks
()
{
m_slot_show_table_details
=
s
igc
::
mem_fun
(
*
this
,
&
AppPythonUICallbacks
::
on_show_table_details
);
s
td
::
bind
(
&
AppPythonUICallbacks
::
on_show_table_details
,
this
,
std
::
placeholders
::
_1
,
std
::
placeholders
::
_2
);
m_slot_show_table_list
=
s
igc
::
mem_fun
(
*
this
,
&
AppPythonUICallbacks
::
on_show_table_list
);
s
td
::
bind
(
&
AppPythonUICallbacks
::
on_show_table_list
,
this
,
std
::
placeholders
::
_1
);
m_slot_print_report
=
s
igc
::
mem_fun
(
*
this
,
&
AppPythonUICallbacks
::
on_print_report
);
s
td
::
bind
(
&
AppPythonUICallbacks
::
on_print_report
,
this
,
std
::
placeholders
::
_1
);
m_slot_print_layout
=
s
igc
::
mem_fun
(
*
this
,
&
AppPythonUICallbacks
::
on_print_layout
);
s
td
::
bind
(
&
AppPythonUICallbacks
::
on_print_layout
,
this
);
m_slot_start_new_record
=
s
igc
::
mem_fun
(
*
this
,
&
AppPythonUICallbacks
::
on_start_new_record
);
s
td
::
bind
(
&
AppPythonUICallbacks
::
on_start_new_record
,
this
);
}
void
AppPythonUICallbacks
::
on_show_table_details
(
const
Glib
::
ustring
&
table_name
,
const
Gnome
::
Gda
::
Value
&
primary_key_value
)
...
...
tests/python/test_python_execute_script.cc
View file @
20194ff9
...
...
@@ -69,15 +69,15 @@ int main()
Glom
::
PythonUICallbacks
callbacks
;
callbacks
.
m_slot_show_table_list
=
sigc
::
ptr_fun
(
&
on_script_ui_show_table_list
)
;
&
on_script_ui_show_table_list
;
callbacks
.
m_slot_show_table_details
=
sigc
::
ptr_fun
(
&
on_script_ui_show_table_details
)
;
&
on_script_ui_show_table_details
;
callbacks
.
m_slot_print_report
=
sigc
::
ptr_fun
(
&
on_script_ui_print_report
)
;
&
on_script_ui_print_report
;
callbacks
.
m_slot_print_layout
=
sigc
::
ptr_fun
(
&
on_script_ui_print_layout
)
;
&
on_script_ui_print_layout
;
callbacks
.
m_slot_start_new_record
=
sigc
::
ptr_fun
(
&
on_script_ui_start_new_record
)
;
&
on_script_ui_start_new_record
;
//Execute a python script:
Glib
::
ustring
error_message
;
...
...
tests/test_selfhosting_utils.cc
View file @
20194ff9
...
...
@@ -254,7 +254,7 @@ bool test_create_and_selfhost_new_database(Glom::Document& document, Glom::Docum
//Create a database:
const
bool
created
=
Glom
::
DbUtils
::
create_database
(
&
document
,
db_name
,
"test title"
,
sigc
::
ptr_fun
(
&
on_db_creation_progress
)
)
;
"test title"
,
&
on_db_creation_progress
);
if
(
!
created
)
{
std
::
cerr
<<
"DbUtils::create_database() failed."
<<
std
::
endl
;
...
...
@@ -357,7 +357,7 @@ bool test_create_and_selfhost_from_uri(const Glib::ustring& example_file_uri, Gl
return
false
;
}
const
bool
recreated
=
Glom
::
DbUtils
::
recreate_database_from_document
(
&
document
,
sigc
::
ptr_fun
(
&
on_recreate_progress
)
);
const
bool
recreated
=
Glom
::
DbUtils
::
recreate_database_from_document
(
&
document
,
&
on_recreate_progress
);
if
(
!
recreated
)
test_selfhosting_cleanup
();
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment