| 1 |
/* Copyright (C) 2006 The gtkmm Development Team |
| 2 |
* |
| 3 |
* This library is free software; you can redistribute it and/or |
| 4 |
* modify it under the terms of the GNU Lesser General Public |
| 5 |
* License as published by the Free Software Foundation; either |
| 6 |
* version 2.1 of the License, or (at your option) any later version. |
| 7 |
* |
| 8 |
* This library is distributed in the hope that it will be useful, |
| 9 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 11 |
* Lesser General Public License for more details. |
| 12 |
* |
| 13 |
* You should have received a copy of the GNU Lesser General Public |
| 14 |
* License along with this library; if not, see <https://www.gnu.org/licenses/>. |
| 15 |
*/ |
| 16 |
|
| 17 |
#include <gtk/gtk.h> |
| 18 |
|
| 19 |
namespace Gtk |
| 20 |
{ |
| 21 |
|
| 22 |
Glib::RefPtr<PageSetup> PageSetup::create_from_key_file(const Glib::KeyFile& key_file) |
| 23 |
{ |
| 24 |
auto result = PageSetup::create(); |
| 25 |
|
| 26 |
result->load_from_key_file(key_file); |
| 27 |
|
| 28 |
return result; |
| 29 |
} |
| 30 |
|
| 31 |
Glib::RefPtr<PageSetup> PageSetup::create_from_key_file(const Glib::KeyFile& key_file, const Glib::ustring& group_name) |
| 32 |
{ |
| 33 |
auto result = PageSetup::create(); |
| 34 |
|
| 35 |
result->load_from_key_file(key_file, group_name); |
| 36 |
|
| 37 |
return result; |
| 38 |
} |
| 39 |
|
| 40 |
Glib::RefPtr<PageSetup> PageSetup::create_from_file(const std::string& file_name) |
| 41 |
{ |
| 42 |
auto result = PageSetup::create(); |
| 43 |
|
| 44 |
result->load_from_file(file_name); |
| 45 |
|
| 46 |
return result; |
| 47 |
} |
| 48 |
|
| 49 |
void PageSetup::save_to_key_file(Glib::KeyFile& key_file) const |
| 50 |
{ |
| 51 |
gtk_page_setup_to_key_file(const_cast<GtkPageSetup*>(gobj()), (key_file).gobj(), nullptr); |
| 52 |
} |
| 53 |
|
| 54 |
bool PageSetup::load_from_key_file(const Glib::KeyFile& key_file) |
| 55 |
{ |
| 56 |
GError* gerror = nullptr; |
| 57 |
bool retvalue = gtk_page_setup_load_key_file(gobj(), const_cast<GKeyFile*>((key_file).gobj()), nullptr, &(gerror)); |
| 58 |
if(gerror) |
| 59 |
::Glib::Error::throw_exception(gerror); |
| 60 |
|
| 61 |
return retvalue; |
| 62 |
} |
| 63 |
|
| 64 |
} //namespace |