tv_rename/gtk/gui.cpp

40 lines
1.2 KiB
C++
Raw Normal View History

2020-03-12 19:52:23 +00:00
#include <errno.h>
#include <error.h>
2019-01-23 19:46:03 +00:00
#include <gtkmm/application.h>
2020-03-12 19:52:23 +00:00
#include <libintl.h>
#include <locale.h>
2019-01-23 19:46:03 +00:00
#include "mainwindow.hpp"
2020-04-01 14:07:37 +00:00
#include "../filesystem.hpp"
#include "../functions.hpp"
#include "../resources_linux.h"
#include "../tv_rename.hpp"
2020-01-16 10:12:22 +00:00
#define API_KEY "42B66F5E-C6BF-423F-ADF9-CC97163472F6"
2020-03-12 19:52:23 +00:00
#define DOMAIN "tv_rename"
2019-01-23 19:46:03 +00:00
2019-02-04 16:39:48 +00:00
int main( int argc, char **argv ) {
auto app = Gtk::Application::create(
argc, argv, "org.idonthaveanorganization.tvrename" );
2019-01-23 19:46:03 +00:00
2020-03-12 19:52:23 +00:00
if ( setlocale( LC_ALL, "" ) == NULL )
error( 1, errno, _( INVALID_LOCALE ).c_str() );
if ( FSLib::exists( "/usr/share/locale/en_US/LC_MESSAGES/tv_rename.mo" ) ) {
if ( bindtextdomain( DOMAIN, "/usr/share/locale" ) == NULL )
error( 1, errno, _( MEM_ALLOC_FAILED ).c_str() );
if ( textdomain( DOMAIN ) == NULL )
error( 1, errno, _( MEM_ALLOC_FAILED ).c_str() );
} else {
if ( bindtextdomain( DOMAIN, "./locale" ) == NULL )
error( 1, errno, _( MEM_ALLOC_FAILED ).c_str() );
if ( textdomain( DOMAIN ) == NULL )
error( 1, errno, _( MEM_ALLOC_FAILED ).c_str() );
}
2020-03-12 19:52:23 +00:00
2020-01-16 10:12:22 +00:00
authenticate( API_KEY );
2019-02-04 16:39:48 +00:00
MainWindow mw( app );
2019-01-23 19:46:03 +00:00
2019-02-04 16:39:48 +00:00
return app->run( mw );
2019-01-23 19:46:03 +00:00
}