Freeciv-3.3
Loading...
Searching...
No Matches
Data Structures | Macros | Functions | Variables
mpgui_gtk5.c File Reference
#include <stdlib.h>
#include <gtk/gtk.h>
#include "fc_cmdline.h"
#include "fciconv.h"
#include "fcintl.h"
#include "log.h"
#include "mem.h"
#include "version.h"
#include "download.h"
#include "mpcmdline.h"
#include "mpdb.h"
#include "modinst.h"

Go to the source code of this file.

Data Structures

struct  _FcMPRow
 
struct  _FcMPRowClass
 
struct  msg_data
 
struct  pbar_data
 

Macros

#define ML_COL_NAME   0
 
#define ML_COL_VER   1
 
#define ML_COL_INST   2
 
#define ML_COL_TYPE   3
 
#define ML_COL_SUBTYPE   4
 
#define ML_COL_LIC   5
 
#define ML_COL_URL   6
 
#define ML_COL_COUNT   7
 
#define ML_TYPE   7
 
#define ML_NOTES   8
 
#define ML_STORE_SIZE   9
 
#define FC_TYPE_MPROW   (fc_mprow_get_type())
 

Functions

static gboolean quit_dialog_callback (void)
 
static void fc_mprow_finalize (GObject *gobject)
 
static void fc_mprow_class_init (FcMPRowClass *klass)
 
static void fc_mprow_init (FcMPRow *self)
 
static FcMPRowfc_mprow_new (void)
 
static void modinst_quit (void)
 
static void quit_dialog_response (GObject *dialog, GAsyncResult *result, gpointer data)
 
static void msg_callback (const char *msg)
 
static void pbar_callback (int downloaded, int max)
 
static gboolean msg_main_thread (gpointer user_data)
 
static void msg_dl_thread (const char *msg)
 
static gboolean pbar_main_thread (gpointer user_data)
 
static void pbar_dl_thread (int current, int max)
 
static gboolean versionlist_update_main_thread (gpointer user_data)
 
static void versionlist_update_dl_thread (void)
 
static gpointer download_thread (gpointer data)
 
static void gui_download_modpack (const char *URL)
 
static void install_clicked (GtkWidget *w, gpointer data)
 
static void URL_return (GtkEntry *w, gpointer data)
 
static gboolean query_main_list_tooltip_cb (GtkWidget *widget, gint x, gint y, gboolean keyboard_tip, GtkTooltip *tooltip, gpointer data)
 
static void setup_modpack_list (const char *name, const char *URL, const char *version, const char *license, enum modpack_type type, const char *subtype, const char *notes)
 
static void selection_change (GtkSelectionModel *model, guint position, guint n_items, gpointer user_data)
 
static void factory_bind (GtkSignalListItemFactory *self, GtkListItem *list_item, gpointer user_data)
 
static void factory_setup (GtkSignalListItemFactory *self, GtkListItem *list_item, gpointer user_data)
 
static void modinst_setup_widgets (void)
 
static void activate_gui (GtkApplication *app, gpointer data)
 
int main (int argc, char *argv[])
 

Variables

static GtkWidgettoplevel
 
static GtkWidgetstatusbar
 
static GtkWidgetprogressbar
 
static GtkWidgetmain_list
 
static GListStoremain_store
 
static GtkWidgetURL_input
 
static GtkAlertDialogquit_dialog
 
static gboolean downloading = FALSE
 
struct fcmp_params fcmp
 
static GtkApplicationfcmp_app
 

Macro Definition Documentation

◆ FC_TYPE_MPROW

#define FC_TYPE_MPROW   (fc_mprow_get_type())

Definition at line 72 of file mpgui_gtk5.c.

◆ ML_COL_COUNT

#define ML_COL_COUNT   7

Definition at line 66 of file mpgui_gtk5.c.

◆ ML_COL_INST

#define ML_COL_INST   2

Definition at line 60 of file mpgui_gtk5.c.

◆ ML_COL_LIC

#define ML_COL_LIC   5

Definition at line 63 of file mpgui_gtk5.c.

◆ ML_COL_NAME

#define ML_COL_NAME   0

Definition at line 58 of file mpgui_gtk5.c.

◆ ML_COL_SUBTYPE

#define ML_COL_SUBTYPE   4

Definition at line 62 of file mpgui_gtk5.c.

◆ ML_COL_TYPE

#define ML_COL_TYPE   3

Definition at line 61 of file mpgui_gtk5.c.

◆ ML_COL_URL

#define ML_COL_URL   6

Definition at line 64 of file mpgui_gtk5.c.

◆ ML_COL_VER

#define ML_COL_VER   1

Definition at line 59 of file mpgui_gtk5.c.

◆ ML_NOTES

#define ML_NOTES   8

Definition at line 69 of file mpgui_gtk5.c.

◆ ML_STORE_SIZE

#define ML_STORE_SIZE   9

Definition at line 70 of file mpgui_gtk5.c.

◆ ML_TYPE

#define ML_TYPE   7

Definition at line 68 of file mpgui_gtk5.c.

Function Documentation

◆ activate_gui()

static void activate_gui ( GtkApplication app,
gpointer  data 
)
static

Run the gui

Definition at line 706 of file mpgui_gtk5.c.

Referenced by main().

◆ download_thread()

static gpointer download_thread ( gpointer  data)
static

Entry point for downloader thread

Definition at line 333 of file mpgui_gtk5.c.

Referenced by gui_download_modpack().

◆ factory_bind()

static void factory_bind ( GtkSignalListItemFactory self,
GtkListItem list_item,
gpointer  user_data 
)
static

Table cell bind function

Definition at line 514 of file mpgui_gtk5.c.

Referenced by modinst_setup_widgets().

◆ factory_setup()

static void factory_setup ( GtkSignalListItemFactory self,
GtkListItem list_item,
gpointer  user_data 
)
static

Table cell setup function

Definition at line 554 of file mpgui_gtk5.c.

Referenced by modinst_setup_widgets().

◆ fc_mprow_class_init()

static void fc_mprow_class_init ( FcMPRowClass klass)
static

Initialization method for FcMPRow class

Definition at line 116 of file mpgui_gtk5.c.

◆ fc_mprow_finalize()

static void fc_mprow_finalize ( GObject gobject)
static

Finalizing method for FcMPRow class

Definition at line 102 of file mpgui_gtk5.c.

Referenced by fc_mprow_class_init().

◆ fc_mprow_init()

static void fc_mprow_init ( FcMPRow self)
static

Initialization method for FcMPRow

Definition at line 127 of file mpgui_gtk5.c.

◆ fc_mprow_new()

static FcMPRow * fc_mprow_new ( void  )
static

FcMPRow creation method

Definition at line 135 of file mpgui_gtk5.c.

Referenced by setup_modpack_list().

◆ gui_download_modpack()

static void gui_download_modpack ( const char URL)
static

Download modpack, display error message dialogs

Definition at line 357 of file mpgui_gtk5.c.

Referenced by activate_gui(), install_clicked(), and URL_return().

◆ install_clicked()

static void install_clicked ( GtkWidget w,
gpointer  data 
)
static

Install modpack button clicked

Definition at line 387 of file mpgui_gtk5.c.

Referenced by modinst_setup_widgets().

◆ main()

int main ( int  argc,
char argv[] 
)

Entry point of the freeciv-modpack program

Definition at line 746 of file mpgui_gtk5.c.

◆ modinst_quit()

static void modinst_quit ( void  )
static

freeciv-modpack quit

Definition at line 147 of file mpgui_gtk5.c.

Referenced by quit_dialog_callback(), and quit_dialog_response().

◆ modinst_setup_widgets()

static void modinst_setup_widgets ( void  )
static

Build widgets

Definition at line 564 of file mpgui_gtk5.c.

Referenced by activate_gui().

◆ msg_callback()

static void msg_callback ( const char msg)
static

Progress indications from downloader

Definition at line 203 of file mpgui_gtk5.c.

Referenced by modinst_setup_widgets(), and msg_main_thread().

◆ msg_dl_thread()

static void msg_dl_thread ( const char msg)
static

Downloader thread message callback.

Definition at line 242 of file mpgui_gtk5.c.

Referenced by download_thread().

◆ msg_main_thread()

static gboolean msg_main_thread ( gpointer  user_data)
static

Main thread handling of message sent from downloader thread.

Definition at line 227 of file mpgui_gtk5.c.

Referenced by msg_dl_thread().

◆ pbar_callback()

static void pbar_callback ( int  downloaded,
int  max 
)
static

Progress indications from downloader

Definition at line 212 of file mpgui_gtk5.c.

Referenced by pbar_main_thread().

◆ pbar_dl_thread()

static void pbar_dl_thread ( int  current,
int  max 
)
static

Downloader thread progress bar callback.

Definition at line 273 of file mpgui_gtk5.c.

Referenced by download_thread().

◆ pbar_main_thread()

static gboolean pbar_main_thread ( gpointer  user_data)
static

Main thread handling of progressbar update sent from downloader thread.

Definition at line 259 of file mpgui_gtk5.c.

Referenced by pbar_dl_thread().

◆ query_main_list_tooltip_cb()

static gboolean query_main_list_tooltip_cb ( GtkWidget widget,
gint  x,
gint  y,
gboolean  keyboard_tip,
GtkTooltip tooltip,
gpointer  data 
)
static

Callback for getting main list row tooltip

Definition at line 411 of file mpgui_gtk5.c.

Referenced by modinst_setup_widgets().

◆ quit_dialog_callback()

static gboolean quit_dialog_callback ( void  )
static

Popups the quit dialog if download in progress

Definition at line 172 of file mpgui_gtk5.c.

Referenced by activate_gui().

◆ quit_dialog_response()

static void quit_dialog_response ( GObject dialog,
GAsyncResult result,
gpointer  data 
)
static

This is the response callback for the dialog with the message: Are you sure you want to quit?

Definition at line 156 of file mpgui_gtk5.c.

Referenced by quit_dialog_callback().

◆ selection_change()

static void selection_change ( GtkSelectionModel model,
guint  position,
guint  n_items,
gpointer  user_data 
)
static

Callback called when entry from main modpack list selected

Definition at line 495 of file mpgui_gtk5.c.

Referenced by modinst_setup_widgets().

◆ setup_modpack_list()

static void setup_modpack_list ( const char name,
const char URL,
const char version,
const char license,
enum modpack_type  type,
const char subtype,
const char notes 
)
static

Build main modpack list view

Definition at line 452 of file mpgui_gtk5.c.

Referenced by modinst_setup_widgets().

◆ URL_return()

static void URL_return ( GtkEntry w,
gpointer  data 
)
static

URL entered

Definition at line 399 of file mpgui_gtk5.c.

Referenced by modinst_setup_widgets().

◆ versionlist_update_dl_thread()

static void versionlist_update_dl_thread ( void  )
static

Downloader thread requests versionlist update.

Definition at line 325 of file mpgui_gtk5.c.

Referenced by download_thread().

◆ versionlist_update_main_thread()

static gboolean versionlist_update_main_thread ( gpointer  user_data)
static

Main thread handling of versionlist update requested by downloader thread

Definition at line 286 of file mpgui_gtk5.c.

Referenced by versionlist_update_dl_thread().

Variable Documentation

◆ downloading

gboolean downloading = FALSE
static

Definition at line 46 of file mpgui_gtk5.c.

Referenced by download_thread(), gui_download_modpack(), and quit_dialog_callback().

◆ fcmp

Initial value:
= {
.list_url = MODPACK_LIST_URL,
.inst_prefix = nullptr,
.autoinstall = nullptr
}
#define MODPACK_LIST_URL
Definition modinst.h:30

Definition at line 48 of file mpgui_gtk5.c.

Referenced by activate_gui(), download_thread(), main(), and modinst_setup_widgets().

◆ fcmp_app

GtkApplication* fcmp_app
static

Definition at line 54 of file mpgui_gtk5.c.

Referenced by main(), and modinst_quit().

◆ main_list

GtkWidget* main_list
static

Definition at line 42 of file mpgui_gtk5.c.

Referenced by modinst_setup_widgets().

◆ main_store

GListStore* main_store
static

◆ progressbar

GtkWidget* progressbar
static

Definition at line 41 of file mpgui_gtk5.c.

Referenced by modinst_setup_widgets(), and pbar_callback().

◆ quit_dialog

GtkAlertDialog* quit_dialog
static

Definition at line 45 of file mpgui_gtk5.c.

Referenced by activate_gui(), quit_dialog_callback(), and quit_dialog_response().

◆ statusbar

GtkWidget* statusbar
static

Definition at line 40 of file mpgui_gtk5.c.

Referenced by gui_download_modpack(), modinst_setup_widgets(), and msg_callback().

◆ toplevel

GtkWidget* toplevel
static

Definition at line 39 of file mpgui_gtk5.c.

Referenced by activate_gui(), modinst_setup_widgets(), and quit_dialog_callback().

◆ URL_input

GtkWidget* URL_input
static

Definition at line 44 of file mpgui_gtk5.c.

Referenced by modinst_setup_widgets(), and selection_change().