Commit baa0549c authored by Murray Cumming's avatar Murray Cumming
Browse files

Avoid some copy/pasting of code.

* glom/mode_design/print_layouts/print_layout_toolbar_button.cc:
* glom/utility_widgets/layouttoolbar.cc:
* glom/utility_widgets/layouttoolbarbutton.cc: Moved get_icon_path() to:
* glom/utils_ui.[h|cc]
parent 1db3de45
2011-10-17 Murray Cumming <murrayc@murrayc.com>
Avoid some copy/pasting of code.
* glom/mode_design/print_layouts/print_layout_toolbar_button.cc:
* glom/utility_widgets/layouttoolbar.cc:
* glom/utility_widgets/layouttoolbarbutton.cc: Moved get_icon_path() to:
* glom/utils_ui.[h|cc]
2011-10-17 Murray Cumming <murrayc@murrayc.com>
Test report contents.
* glom/libglom/xsl_utils.[h|cc]: transform(): Return the contents,
not a filepath.
* glom/libglom/report_builder.[h|cc]: report_build(): return the
contents, not the path. Add report_build_and_save() to get a temporary
filepath.
* glom/mode_data/box_data_manyrecords.cc:
* glom/frame_glom.cc: Adapted.
* tests/test_selfhosting_new_then_report.cc: Check that some expected
text is in the generated HTML.
2011-10-17 Murray Cumming <murrayc@murrayc.com>
Test report building.
* tests/test_selfhosting_new_from_example.cc: Move most code into
utility functions in:
* tests/test_selfhosting_utils.[h|cc]:
* tests/test_selfhosting_new_then_report.cc: Add a new test that also
generates a HTML report.
* Makefile_tests: Mention the new files.
2011-10-18 Murray Cumming <murrayc@murrayc.com>
Film Manager example: Change default table.
......@@ -48,32 +82,7 @@
Correct the pkg-config file.
* glom/libglom/glom.pc.in: Depend on libgdamm-5.0, not ligdamm-4.0.
And depend on libxslt, because we just moved the xslt stuff into libglom.
2011-10-17 Murray Cumming <murrayc@murrayc.com>
Test report contents.
* glom/libglom/xsl_utils.[h|cc]: transform(): Return the contents,
not a filepath.
* glom/libglom/report_builder.[h|cc]: report_build(): return the
contents, not the path. Add report_build_and_save() to get a temporary
filepath.
* glom/mode_data/box_data_manyrecords.cc:
* glom/frame_glom.cc: Adapted.
* tests/test_selfhosting_new_then_report.cc: Check that some expected
text is in the generated HTML.
2011-10-17 Murray Cumming <murrayc@murrayc.com>
Test report building.
* tests/test_selfhosting_new_from_example.cc: Move most code into
utility functions in:
* tests/test_selfhosting_utils.[h|cc]:
* tests/test_selfhosting_new_then_report.cc: Add a new test that also
generates a HTML report.
* Makefile_tests: Mention the new files.
And depend on libxslt, because we just moved the xslt stuff into libglom.
2011-10-17 Murray Cumming <murrayc@murrayc.com>
......
......@@ -19,34 +19,16 @@
*/
#include "print_layout_toolbar_button.h"
#include <glom/utils_ui.h>
#include <gtkmm/toolpalette.h>
#include <iostream>
namespace
{
std::string get_icon_path(const std::string& filename)
{
#ifdef G_OS_WIN32
gchar* basepath = g_win32_get_package_installation_directory_of_module(0);
const std::string result = Glib::build_filename(Glib::build_filename(basepath,
"share" G_DIR_SEPARATOR_S "glom" G_DIR_SEPARATOR_S "pixmaps"), filename);
g_free(basepath);
return result;
#else
return Glib::build_filename(GLOM_PKGDATADIR G_DIR_SEPARATOR_S "pixmaps", filename);
#endif
}
} //anonymous namespace
namespace Glom
{
PrintLayoutToolbarButton::PrintLayoutToolbarButton(const std::string& icon_name, enumItems type,
const Glib::ustring& title, const Glib::ustring& tooltip)
: Gtk::ToolButton( *(Gtk::manage (new Gtk::Image(get_icon_path(icon_name)))) )
: Gtk::ToolButton( *(Gtk::manage (new Gtk::Image(Utils::get_icon_path(icon_name)))) )
{
m_type = type;
g_object_set_data(G_OBJECT(gobj()), "glom-type", GINT_TO_POINTER(type));
......
......@@ -25,24 +25,6 @@
#include "layoutwidgetbase.h"
namespace
{
Glib::ustring get_icon_path(const Glib::ustring& filename)
{
#ifdef G_OS_WIN32
gchar* basepath = g_win32_get_package_installation_directory_of_module(0);
Glib::ustring result = Glib::build_filename(Glib::build_filename(basepath,
"share" G_DIR_SEPARATOR_S "glom" G_DIR_SEPARATOR_S "pixmaps"), filename);
g_free(basepath);
return result;
#else
return Glib::build_filename(GLOM_PKGDATADIR G_DIR_SEPARATOR_S "pixmaps", filename);
#endif
}
} //anonymous namespace
namespace Glom
{
......
......@@ -20,32 +20,14 @@
#include <gtkmm.h>
#include "layouttoolbarbutton.h"
namespace
{
std::string get_icon_path(const std::string& filename)
{
#ifdef G_OS_WIN32
gchar* basepath = g_win32_get_package_installation_directory_of_module(0);
const std::string result = Glib::build_filename(Glib::build_filename(basepath,
"share" G_DIR_SEPARATOR_S "glom" G_DIR_SEPARATOR_S "pixmaps"), filename);
g_free(basepath);
return result;
#else
return Glib::build_filename(GLOM_PKGDATADIR G_DIR_SEPARATOR_S "pixmaps", filename);
#endif
}
} //anonymous namespace
#include <glom/utils_ui.h>
namespace Glom
{
LayoutToolbarButton::LayoutToolbarButton(const std::string& icon_name, LayoutWidgetBase::enumType type,
const Glib::ustring& title, const Glib::ustring& tooltip)
: Gtk::ToolButton( *(Gtk::manage (new Gtk::Image(get_icon_path(icon_name)))) )
: Gtk::ToolButton( *(Gtk::manage (new Gtk::Image(Utils::get_icon_path(icon_name)))) )
{
m_type = type;
g_object_set_data(G_OBJECT(gobj()), "glom-type", GINT_TO_POINTER(type));
......
......@@ -517,4 +517,17 @@ void Utils::show_report_in_browser(const std::string& filepath, Gtk::Window* par
#endif //G_OS_WIN32
}
std::string Utils::get_icon_path(const Glib::ustring& filename)
{
#ifdef G_OS_WIN32
gchar* basepath = g_win32_get_package_installation_directory_of_module(0);
const std::string result = Glib::build_filename(Glib::build_filename(basepath,
"share" G_DIR_SEPARATOR_S "glom" G_DIR_SEPARATOR_S "pixmaps"), filename);
g_free(basepath);
return result;
#else
return Glib::build_filename(GLOM_PKGDATADIR G_DIR_SEPARATOR_S "pixmaps", filename);
#endif
}
} //namespace Glom
......@@ -96,6 +96,8 @@ bool show_warning_no_records_found(Gtk::Window& transient_for);
void show_report_in_browser(const std::string& filepath, Gtk::Window* parent_window);
std::string get_icon_path(const Glib::ustring& filename);
} //namespace Utils
} //namespace Glom
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment