cleaning only; application = self << ? (contain.c line 346)

This commit is contained in:
Jean Sirmai 2024-06-01 11:32:57 +02:00
parent dabf980346
commit e69af6b007
Signed by: jean
GPG Key ID: FB3115C340E057E3
5 changed files with 202 additions and 88 deletions

View File

@ -27,4 +27,17 @@ void on_togglerunedit_action (GSimpleAction *action, GVariant *parameter, gpoint
ui_toggle_run_edit (); ui_toggle_run_edit ();
} }
void on_quit_action (GSimpleAction *action, GVariant *parameter, gpointer user_data) {}
void on_about_action (GSimpleAction *action, GVariant *parameter, gpointer user_data) {}
void on_preferences_action (GSimpleAction *action, GVariant *parameter, gpointer user_data) {}
void on_togglerunstop_action (GSimpleAction *action, GVariant *parameter, gpointer user_data) {}
void on_togglesidebar_action (GSimpleAction *action, GVariant *parameter, gpointer user_data) {}
void on_editmode_action (GSimpleAction *action, GVariant *parameter, gpointer user_data) {}
void on_runmode_action (GSimpleAction *action, GVariant *parameter, gpointer user_data) {}
void on_presentmode_action (GSimpleAction *action, GVariant *parameter, gpointer user_data) {}
void on_openfile_action (GSimpleAction *action, GVariant *parameter, gpointer user_data) {}
void on_closefile_action (GSimpleAction *action, GVariant *parameter, gpointer user_data) {}
void on_savefile_action (GSimpleAction *action, GVariant *parameter, gpointer user_data) {}
void on_toast_close_action (GSimpleAction *action, GVariant *parameter, gpointer user_data) {}

View File

@ -1,2 +1,50 @@
void on_togglerunedit_action (GSimpleAction *action, GVariant *parameter, gpointer user_data); void ui_enable_action (const char *name);
void ui_disable_action (const char *name);
void set_run_edit_mode(int prescribed_mode);
int get_run_edit_mode();
// je vais déjà voir si j'arrive à manoeuvrer ces deux là... (2024-05-30)
// GtkWidget *btt_run_xor_edit = gtk_toggle_button_new ();
// GtkWidget *btt_run_stop_exec = gtk_toggle_button_new ();
// https://docs.gtk.org/gio/method.ActionMap.add_action_entries.html
// A function for creating multiple GSimpleAction instances and adding them to a GActionMap.
// @see application . gem_graph_client_application_init (GemGraphClientApplication *self) {
// g_action_map_add_action_entries (G_ACTION_MAP(self), app_actions, G_N_ELEMENTS(app_actions), self); ...
void ui_toggle_run_edit(); void ui_toggle_run_edit();
void on_quit_action (GSimpleAction *action, GVariant *parameter, gpointer user_data);
void on_about_action (GSimpleAction *action, GVariant *parameter, gpointer user_data);
void on_preferences_action (GSimpleAction *action, GVariant *parameter, gpointer user_data);
// my "action of interest" : (2024-06-01)
void on_togglerunedit_action (GSimpleAction *action, GVariant *parameter, gpointer user_data);
//
void on_togglerunstop_action (GSimpleAction *action, GVariant *parameter, gpointer user_data);
void on_togglesidebar_action (GSimpleAction *action, GVariant *parameter, gpointer user_data);
void on_editmode_action (GSimpleAction *action, GVariant *parameter, gpointer user_data);
void on_runmode_action (GSimpleAction *action, GVariant *parameter, gpointer user_data);
void on_presentmode_action (GSimpleAction *action, GVariant *parameter, gpointer user_data);
void on_openfile_action (GSimpleAction *action, GVariant *parameter, gpointer user_data);
void on_closefile_action (GSimpleAction *action, GVariant *parameter, gpointer user_data);
void on_savefile_action (GSimpleAction *action, GVariant *parameter, gpointer user_data);
void on_toast_close_action (GSimpleAction *action, GVariant *parameter, gpointer user_data);
static const GActionEntry app_actions[] = {
{ "quit", on_quit_action, NULL, NULL, NULL },
{ "about", on_about_action, NULL, NULL, NULL },
{ "preferences", on_preferences_action, NULL, NULL, NULL },
{ "togglerunedit", on_togglerunedit_action, NULL, NULL, NULL },
{ "togglerunstop", on_togglerunstop_action, NULL, NULL, NULL },
{ "togglesidebar", on_togglesidebar_action, NULL, NULL, NULL },
{ "editmode", on_editmode_action, NULL, NULL, NULL },
{ "runmode", on_runmode_action, NULL, NULL, NULL },
{ "presentmode", on_presentmode_action, NULL, NULL, NULL },
{ "openfile", on_openfile_action, NULL, NULL, NULL },
{ "closefile", on_closefile_action, NULL, NULL, NULL },
{ "savefile", on_savefile_action, NULL, NULL, NULL },
{ "toastclose", on_toast_close_action, NULL, NULL, NULL },
};

212
contain.c
View File

@ -168,110 +168,113 @@ GtkWidget *get_run_space_page_new(){
return GTK_WIDGET (page_box); return GTK_WIDGET (page_box);
} }
GtkWidget *get_btt_run_xor_edit() { GtkButton *get_btt_run_xor_edit() {
GtkWidget *run_xor_edit = gtk_toggle_button_new (); GtkButton *run_xor_edit = GTK_BUTTON (gtk_toggle_button_new ());
return GTK_WIDGET (run_xor_edit); return run_xor_edit;
}
static void icons_for_fun (GtkHeaderBar *header_bar)
{
GtkButton *go_home = GTK_BUTTON (gtk_button_new ());
gtk_button_set_icon_name (go_home, "go-home-symbolic");
gtk_header_bar_pack_end (header_bar, GTK_WIDGET (go_home));
GtkButton *user_trash = GTK_BUTTON (gtk_button_new ());
gtk_button_set_icon_name (user_trash, "user-trash-symbolic");
gtk_header_bar_pack_end (header_bar, GTK_WIDGET (user_trash));
GtkButton *help_biblio = GTK_BUTTON (gtk_button_new ());
gtk_button_set_icon_name (help_biblio, "accessories-dictionary-symbolic");
gtk_header_bar_pack_end (header_bar, GTK_WIDGET (help_biblio));
GtkButton *help_doc = GTK_BUTTON (gtk_button_new ());
gtk_button_set_icon_name (help_doc, "emblem-documents-symbolic");
gtk_header_bar_pack_end (header_bar, GTK_WIDGET (help_doc));
GtkButton *help_about = GTK_BUTTON (gtk_button_new ());
gtk_button_set_icon_name (help_about, "help-about-symbolic");
gtk_header_bar_pack_end (header_bar, GTK_WIDGET (help_about));
GtkButton *help_faq = GTK_BUTTON (gtk_button_new ());
gtk_button_set_icon_name (help_faq, "help-faq-symbolic");
gtk_header_bar_pack_end (header_bar, GTK_WIDGET (help_faq));
GtkButton *terminal = GTK_BUTTON (gtk_button_new ());
gtk_button_set_icon_name (terminal, "utilities-terminal-symbolic");
gtk_header_bar_pack_end (header_bar, GTK_WIDGET (terminal));
GtkButton *search = GTK_BUTTON (gtk_button_new ());
gtk_button_set_icon_name (search, "folder-saved-search-symbolic");
gtk_header_bar_pack_end (header_bar, GTK_WIDGET (search));
GtkButton *preferences_desktop_appearance = GTK_BUTTON (gtk_button_new ());
gtk_button_set_icon_name (preferences_desktop_appearance, "preferences-desktop-appearance-symbolic");
gtk_header_bar_pack_end (header_bar, GTK_WIDGET (preferences_desktop_appearance));
GtkButton *preferences_system = GTK_BUTTON (gtk_button_new ());
gtk_button_set_icon_name (preferences_system, "preferences-system-symbolic");
gtk_header_bar_pack_end (header_bar, GTK_WIDGET (preferences_system));
GtkButton *document_properties = GTK_BUTTON (gtk_button_new ());
gtk_button_set_icon_name (document_properties, "document-properties-symbolic");
gtk_header_bar_pack_end (header_bar, GTK_WIDGET (document_properties));
GtkButton *text_edit = GTK_BUTTON (gtk_button_new ());
gtk_button_set_icon_name (text_edit, "text-editor-symbolic");
gtk_header_bar_pack_end (header_bar, GTK_WIDGET (text_edit));
GtkButton *applications_utilities = GTK_BUTTON (gtk_button_new ());
gtk_button_set_icon_name (applications_utilities, "applications-utilities-symbolic");
gtk_header_bar_pack_end (header_bar, GTK_WIDGET (applications_utilities));
GtkButton *open_menu = GTK_BUTTON (gtk_button_new ());
gtk_button_set_icon_name (open_menu, "open-menu-symbolic");
gtk_header_bar_pack_end (header_bar, GTK_WIDGET (open_menu));
GtkButton *power_max = GTK_BUTTON (gtk_button_new ());
gtk_button_set_icon_name (power_max, "power-profile-performance-symbolic");
gtk_header_bar_pack_end (header_bar, GTK_WIDGET (power_max));
GtkButton *power_middle = GTK_BUTTON (gtk_button_new ());
gtk_button_set_icon_name (power_middle, "power-profile-balanced-rtl-symbolic");
gtk_header_bar_pack_end (header_bar, GTK_WIDGET (power_middle));
GtkButton *power_low = GTK_BUTTON (gtk_button_new ());
gtk_button_set_icon_name (power_low, "power-profile-power-saver-symbolic");
gtk_header_bar_pack_end (header_bar, GTK_WIDGET (power_low));
} }
void window_bar(GtkWindow *window, char *title){ void window_bar(GtkWindow *window, char *title){
GtkWidget *header_bar = gtk_header_bar_new(); GtkWidget *header_bar = GTK_WIDGET (gtk_header_bar_new());
gtk_window_set_titlebar (window, header_bar); gtk_window_set_titlebar (window, header_bar);
// GtkWidget my_window_controls = *gtk_window_controls_new (GTK_PACK_END); // _START // GtkWidget my_window_controls = *gtk_window_controls_new (GTK_PACK_END); // _START
// gtk_window_controls_set_decoration_layout (GTK_WINDOW_CONTROLS(my_window_controls), NULL); // const char* layout); // gtk_window_controls_set_decoration_layout (GTK_WINDOW_CONTROLS(my_window_controls), NULL); // const char* layout);
gtk_button_set_icon_name (GTK_BUTTON (get_btt_run_xor_edit()), "document-edit-symbolic"); gtk_button_set_icon_name (get_btt_run_xor_edit(), "document-edit-symbolic");
gtk_button_set_icon_name (GTK_BUTTON (get_btt_run_xor_edit()), "text-editor-symbolic"); gtk_button_set_icon_name (get_btt_run_xor_edit(), "text-editor-symbolic");
gtk_button_set_icon_name (GTK_BUTTON (get_btt_run_xor_edit()), "system-run-symbolic"); gtk_button_set_icon_name (get_btt_run_xor_edit(), "system-run-symbolic");
g_signal_connect (GTK_BUTTON (get_btt_run_xor_edit()), g_signal_connect (get_btt_run_xor_edit(),
"clicked", "clicked",
G_CALLBACK (on_togglerunedit_action), G_CALLBACK (on_togglerunedit_action),
NULL); NULL);
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), get_btt_run_xor_edit()); gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (get_btt_run_xor_edit()));
gtk_window_set_titlebar (window, header_bar); gtk_window_set_titlebar (window, header_bar);
GtkWidget *run_stop_model_exec = gtk_button_new (); GtkButton *run_stop_model_exec = GTK_BUTTON (gtk_button_new ());
gtk_button_set_icon_name (GTK_BUTTON (run_stop_model_exec), "system-shutdown-symbolic"); gtk_button_set_icon_name (run_stop_model_exec, "system-shutdown-symbolic");
gtk_button_set_icon_name (GTK_BUTTON (run_stop_model_exec), "media-playback-start-symbolic"); gtk_button_set_icon_name (run_stop_model_exec, "media-playback-start-symbolic");
gtk_button_set_icon_name (GTK_BUTTON (run_stop_model_exec), "media-playback-pause-symbolic"); gtk_button_set_icon_name (run_stop_model_exec, "media-playback-pause-symbolic");
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), run_stop_model_exec); gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (run_stop_model_exec));
// https://iconduck.com/sets/adwaita-icon-theme
GtkWidget *go_home = gtk_button_new ();
gtk_button_set_icon_name (GTK_BUTTON (go_home), "go-home-symbolic");
gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), go_home);
GtkWidget *user_trash = gtk_button_new ();
gtk_button_set_icon_name (GTK_BUTTON (user_trash), "user-trash-symbolic");
gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), user_trash);
GtkWidget *help_biblio = gtk_button_new ();
gtk_button_set_icon_name (GTK_BUTTON (help_biblio), "accessories-dictionary-symbolic");
gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), help_biblio);
GtkWidget *help_doc = gtk_button_new ();
gtk_button_set_icon_name (GTK_BUTTON (help_doc), "emblem-documents-symbolic");
gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), help_doc);
GtkWidget *help_about = gtk_button_new ();
gtk_button_set_icon_name (GTK_BUTTON (help_about), "help-about-symbolic");
gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), help_about);
GtkWidget *help_faq = gtk_button_new ();
gtk_button_set_icon_name (GTK_BUTTON (help_faq), "help-faq-symbolic");
gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), help_faq);
GtkWidget *terminal = gtk_button_new ();
gtk_button_set_icon_name (GTK_BUTTON (terminal), "utilities-terminal-symbolic");
gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), terminal);
GtkWidget *search = gtk_button_new ();
gtk_button_set_icon_name (GTK_BUTTON (search), "folder-saved-search-symbolic");
gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), search);
GtkWidget *preferences_desktop_appearance = gtk_button_new ();
gtk_button_set_icon_name (GTK_BUTTON (preferences_desktop_appearance), "preferences-desktop-appearance-symbolic");
gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), preferences_desktop_appearance);
GtkWidget *preferences_system = gtk_button_new ();
gtk_button_set_icon_name (GTK_BUTTON (preferences_system), "preferences-system-symbolic");
gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), preferences_system);
GtkWidget *document_properties = gtk_button_new ();
gtk_button_set_icon_name (GTK_BUTTON (document_properties), "document-properties-symbolic");
gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), document_properties);
GtkWidget *text_edit = gtk_button_new ();
gtk_button_set_icon_name (GTK_BUTTON (text_edit), "text-editor-symbolic");
gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), text_edit);
GtkWidget *applications_utilities = gtk_button_new ();
gtk_button_set_icon_name (GTK_BUTTON (applications_utilities), "applications-utilities-symbolic");
gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), applications_utilities);
GtkWidget *open_menu = gtk_button_new ();
gtk_button_set_icon_name (GTK_BUTTON (open_menu), "open-menu-symbolic");
gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), open_menu);
GtkWidget *power_max = gtk_button_new ();
gtk_button_set_icon_name (GTK_BUTTON (power_max), "power-profile-performance-symbolic");
gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), power_max);
GtkWidget *power_middle = gtk_button_new ();
gtk_button_set_icon_name (GTK_BUTTON (power_middle), "power-profile-balanced-rtl-symbolic");
gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), power_middle);
GtkWidget *power_low = gtk_button_new ();
gtk_button_set_icon_name (GTK_BUTTON (power_low), "power-profile-power-saver-symbolic");
gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), power_low);
icons_for_fun (GTK_HEADER_BAR (header_bar)); // https://iconduck.com/sets/adwaita-icon-theme
} }
void activate (GtkApplication *app, gpointer user_data) { void activate (GtkApplication *self, gpointer user_data) {
GtkWindow *window = GTK_WINDOW (gtk_application_window_new (app));
GtkWindow *window = GTK_WINDOW (gtk_application_window_new (self));
window_bar (window, "E coli (with permission from David S. Goodsell, 2009)"); window_bar (window, "E coli (with permission from David S. Goodsell, 2009)");
GtkNotebook *run_notebook = GTK_NOTEBOOK(gtk_notebook_new()); GtkNotebook *run_notebook = GTK_NOTEBOOK(gtk_notebook_new());
@ -306,3 +309,40 @@ void activate (GtkApplication *app, gpointer user_data) {
gtk_notebook_set_current_page (edit_notebook, 1); // @see hot.c 2024-05-11 (line 68) gtk_notebook_set_current_page (edit_notebook, 1); // @see hot.c 2024-05-11 (line 68)
} }
/*------------------------------------------------------------------------------
struct _MyApplication {GtkApplication parent_instance;};
G_DEFINE_TYPE (MyApplication,
my_application,
GTK_TYPE_APPLICATION)
static MyApplication *application;
void ui_enable_action (const char *name) {
g_simple_action_set_enabled (
(GSimpleAction *)g_action_map_lookup_action(
G_ACTION_MAP(application),
name),
true);
}
void ui_disable_action (const char *name) {
g_simple_action_set_enabled (
(GSimpleAction *)g_action_map_lookup_action(
G_ACTION_MAP(application),
name),
false);
}
// Action records are registered here
static void my_application_init (MyApplication *self)
{
g_action_map_add_action_entries(G_ACTION_MAP(self),
app_actions,
G_N_ELEMENTS(app_actions),
self);
application = self;
}
*/

View File

@ -15,6 +15,19 @@
#define W_IMAGE_LOCAL W / 16 #define W_IMAGE_LOCAL W / 16
#define H_IMAGE_LOCAL H / 16 #define H_IMAGE_LOCAL H / 16
/*
G_BEGIN_DECLS
#define MY_TYPE_WINDOW (my_window_get_type())
G_DECLARE_FINAL_TYPE (MyWindow, my_window, MY, WINDOW, GtkApplicationWindow)
G_END_DECLS
G_BEGIN_DECLS
#define MY_TYPE_APPLICATION (my_application_get_type())
G_DECLARE_FINAL_TYPE (MyApplication, my_application, MY, APPLICATION, GtkApplication)
MyApplication *my_application_new (const char *application_id, GApplicationFlags flags);
G_END_DECLS
*/
GtkWidget *get_selected_rules_vpaned_new(); GtkWidget *get_selected_rules_vpaned_new();
void activate (GtkApplication *app, gpointer user_data); void activate (GtkApplication *app, gpointer user_data);

View File

@ -30,7 +30,7 @@ GtkBox *get_XYZ_box();
GtkWidget *get_OBJECTS_and_SITUATIONS(); GtkWidget *get_OBJECTS_and_SITUATIONS();
GtkBox *get_ELAPSED_TIME_box(); GtkBox *get_ELAPSED_TIME_box();
GtkWidget *get_btt_run_xor_edit(); GtkButton *get_btt_run_xor_edit();
void window_bar(GtkWindow *window, char *title); void window_bar(GtkWindow *window, char *title);