I'm trying to write a GTK+3 application using C.
I created a glade file with an action that it's id is 'tracks_deck.add_empty_track'.
i connected the action to a toolbar item and a menu item.
the question is how do I connect a function to that action ?
I have the following C Code:
#include <gtk/gtk.h>
#define UI_FILE "tuxmusicstudio.glade"
#define TOP_WINDOW "application_window"
int main (int argc, char *argv[])
{
GtkWidget *main_window;
GtkBuilder *builder;
GError *error = NULL;
GtkAction *action;
gtk_init (&argc, &argv);
builder = gtk_builder_new();
if (!gtk_builder_add_from_file(builder, UI_FILE, &error)) {
g_critical("couldn't load builder file: %s",error->message);
g_error_free(error);
}
/* create the main, top level, window */
main_window = GTK_WIDGET(gtk_builder_get_object(builder, TOP_WINDOW));
if (!main_window) {
g_critical("widget \"%s\" is missing in file %s.",TOP_WINDOW,UI_FILE);
}
action = GTK_ACTION(gtk_builder_get_object(builder, "tracks_deck.add_empty_track"));
if (!action) {
g_critical("could not fetch action tracks_deck.empty_track");
}
gtk_widget_show_all (main_window);
/* start the main loop, and let it rest there until the application is closed */
gtk_main ();
return 0;
so as you can see i'm trying to fetch the GtkAction in order to connect a function to it. the compiler is compiling that this line is deprecated:
main.c:46:5: warning: ‘gtk_action_get_type’ is deprecated (declared at /usr/include/gtk-3.0/gtk/deprecated/gtkaction.h:87) [-Wdeprecated-declarations]
action = GTK_ACTION(gtk_builder_get_object(builder, "tracks_deck.add_empty_track"));
^
so how do I fetch the GtkAction with some function that is not deprecated. and how do I connect the a c function to that action?!
any ideas regarding the issue would be greatly appreciated.