Where exactly did I asked about helping me to fix/make my Homework?
Did I not provide my work and did I not said, that I have a working assignment which actually works?
If I was asking for a Question, it was because I needed some information and I was definitely not expecting someone to fix my code.
Now to be honest I am not sure for what are you standing here for. I thought that I had a fair Question and a fair Answer to this Question was expected as well.
If I ask something in Italian Language, I do not want to know how one in Spanish would spell or say it just because they are similar and both are Latin.
I just asked, if there are 3 groups created and need them to insert them into my Application (not widget) how do I do that. If me is the problem because I use it wrong, then you are those who will tell me that It can not be done or it is a wrong approach, isn’t it?
I even provided a strait example code which illustrate the situation, but I got nothing which helps me (or at least something which I understand. I simply do not speak Python).
This means that either I can not do it in C or you are not willing to point me to that direction.
This Is what I have at this point:
#include <gtk/gtk.h>
void one_call ( GSimpleAction *action, GVariant *parameter, gpointer user_data );
void two_call ( GSimpleAction *action, GVariant *parameter, gpointer user_data );
void tree_call ( GSimpleAction *action, GVariant *parameter, gpointer user_data );
void first_call ( GSimpleAction *action, GVariant *parameter, gpointer user_data );
void second_call ( GSimpleAction *action, GVariant *parameter, gpointer user_data );
void third_call ( GSimpleAction *action, GVariant *parameter, gpointer user_data );
void file_call ( GSimpleAction *action, GVariant *parameter, gpointer user_data );
static void startup ( GtkApplication *app )
{
GSimpleActionGroup *first_group;
GSimpleActionGroup *second_group;
GSimpleActionGroup *third_group;
static const GActionEntry first_accell[] =
{
{ "one", one_call, NULL, NULL, NULL, { 0, 0, 0 } },
{ "two", two_call, NULL, NULL, NULL, { 0, 0, 0 } },
{ "tree", tree_call, NULL, NULL, NULL, { 0, 0, 0 } },
};
static const GActionEntry second_accell[] =
{
{ "file", file_call, NULL, NULL, NULL, { 0, 0, 0 } }
};
static const GActionEntry third_accell[] =
{
{ "first", first_call, NULL, NULL, NULL, { 0, 0, 0 } },
{ "secont", second_call, NULL, NULL, NULL, { 0, 0, 0 } },
{ "third", third_call, NULL, NULL, NULL, { 0, 0, 0 } },
};
first_group = g_simple_action_group_new ();
second_group = g_simple_action_group_new ();
third_group = g_simple_action_group_new ();
g_action_map_add_action_entries ( G_ACTION_MAP( first_group ), first_accell, G_N_ELEMENTS ( first_accell ), app );
g_action_map_add_action_entries ( G_ACTION_MAP( second_group ), second_accell, G_N_ELEMENTS ( second_accell ), NULL );
g_action_map_add_action_entries ( G_ACTION_MAP( third_group ), third_accell, G_N_ELEMENTS ( third_accell ), NULL );
}
static void activate ( GtkApplication *app )
{
GtkWidget *window;
GMenu *menu;
GMenu *first_menu;
GMenuItem *item;
window = gtk_application_window_new ( app );
gtk_window_set_default_size ( GTK_WINDOW ( window ), 200, 200 );
gtk_window_set_application ( GTK_WINDOW ( window ), GTK_APPLICATION ( app ) );
gtk_window_set_title ( GTK_WINDOW ( window ), "Example" );
menu = g_menu_new ();
first_menu = g_menu_new ();
g_menu_insert_submenu ( menu, 0, "First", G_MENU_MODEL ( first_menu ) );
item = g_menu_item_new ( "One", "app.one" );
g_menu_insert_item ( first_menu, 0, G_MENU_ITEM ( item ) );
g_object_unref ( item );
item = g_menu_item_new ( "Two", "app.two" );
g_menu_insert_item ( first_menu, 1, G_MENU_ITEM ( item ) );
g_object_unref ( item );
item = g_menu_item_new ( "Tree", "app.tree" );
g_menu_insert_item ( first_menu, 2, G_MENU_ITEM ( item ) );
g_object_unref ( item );
gtk_application_set_menubar ( app, G_MENU_MODEL ( menu ) );
gtk_widget_show_all ( GTK_WIDGET ( window ) );
g_object_unref ( menu );
}
int main ( void )
{
GtkApplication *app;
int status;
app = gtk_application_new ( "org.gtk.example", G_APPLICATION_FLAGS_NONE );
g_signal_connect_swapped ( app, "startup", G_CALLBACK ( startup ), app );
g_signal_connect_swapped ( app, "activate", G_CALLBACK ( activate ), app );
status = g_application_run ( G_APPLICATION ( app ), 0, NULL );
g_object_unref ( app );
return status;
}
void one_call ( GSimpleAction *action, GVariant *parameter, gpointer user_data )
{
( void ) action;
( void ) parameter;
( void ) user_data;
g_print ( "You clicked One call\n" );
}
void two_call ( GSimpleAction *action, GVariant *parameter, gpointer user_data )
{
( void ) action;
( void ) parameter;
( void ) user_data;
g_print ( "You clicked TWO call\n" );
}
void tree_call ( GSimpleAction *action, GVariant *parameter, gpointer user_data )
{
( void ) action;
( void ) parameter;
( void ) user_data;
g_print ( "You clicked Open file\n" );
}
void first_call ( GSimpleAction *action, GVariant *parameter, gpointer user_data )
{
( void ) action;
( void ) parameter;
( void ) user_data;
g_print ( "You clicked Undo\n" );
}
void second_call ( GSimpleAction *action, GVariant *parameter, gpointer user_data )
{
( void ) action;
( void ) parameter;
( void ) user_data;
g_print ( "You clicked Cut\n" );
}
void third_call ( GSimpleAction *action, GVariant *parameter, gpointer user_data )
{
( void ) action;
( void ) parameter;
( void ) user_data;
g_print ( "You clicked Copy\n" );
}
void file_call ( GSimpleAction *action, GVariant *parameter, gpointer user_data )
{
( void ) action;
( void ) parameter;
( void ) user_data;
g_print ( "You clicked Save file\n" );
}