Compare commits

...

3 Commits

Author SHA1 Message Date
karthikmurakonda 5d8acb43cf fix: edit buttons sensitivity in menubar 2022-10-09 23:52:44 +05:30
karthikmurakonda 5372e77c73 fix: setting sensitivy of utility tools button 2022-10-09 23:40:13 +05:30
karthikmurakonda e82a8b3630 fixed errors on destroying util window 2022-10-09 23:18:08 +05:30
4 changed files with 19 additions and 19 deletions

View File

@ -150,9 +150,9 @@ int main(int argc, char **argv)
gtk_widget_set_sensitive(GTK_WIDGET(data->add_pdc_button), FALSE); gtk_widget_set_sensitive(GTK_WIDGET(data->add_pdc_button), FALSE);
gtk_widget_set_sensitive(GTK_WIDGET(data->remove_pdc_button), FALSE); gtk_widget_set_sensitive(GTK_WIDGET(data->remove_pdc_button), FALSE);
gtk_widget_set_sensitive(GTK_WIDGET(data->display_conn_table_button), FALSE); gtk_widget_set_sensitive(GTK_WIDGET(data->display_conn_table_button), FALSE);
//gtk_widget_set_sensitive(GTK_WIDGET(data->utility_tools), FALSE); gtk_widget_set_sensitive(GTK_WIDGET(data->utility_tools), FALSE);
// gtk_widget_set_visible(GTK_WIDGET(data->menuitem2), TRUE); gtk_widget_set_visible(GTK_WIDGET(data->menuitem2), FALSE);
gtk_widget_set_visible(GTK_WIDGET(data->menu_conn_table), FALSE); gtk_widget_set_visible(GTK_WIDGET(data->menu_conn_table), FALSE);
gtk_widget_set_visible(GTK_WIDGET(data->pdc_details_menuitem), FALSE); gtk_widget_set_visible(GTK_WIDGET(data->pdc_details_menuitem), FALSE);

View File

@ -643,9 +643,9 @@ void final_pdc_setup_call()
gtk_widget_set_sensitive(GTK_WIDGET(data->add_pdc_button), TRUE); gtk_widget_set_sensitive(GTK_WIDGET(data->add_pdc_button), TRUE);
gtk_widget_set_sensitive(GTK_WIDGET(data->remove_pdc_button), TRUE); gtk_widget_set_sensitive(GTK_WIDGET(data->remove_pdc_button), TRUE);
gtk_widget_set_sensitive(GTK_WIDGET(data->display_conn_table_button), TRUE); gtk_widget_set_sensitive(GTK_WIDGET(data->display_conn_table_button), TRUE);
gtk_widget_set_sensitive(GTK_WIDGET(data->utility_tools), TRUE);
// gtk_menu_attach_to_widget (GTK_MENU (data->menuitem2), GTK_WIDGET (data->ipdc), NULL); gtk_menu_attach_to_widget (GTK_MENU (data->menuitem2), GTK_WIDGET (data->ipdc), NULL);
// gtk_widget_show (data->ipdc);
gtk_widget_set_visible(GTK_WIDGET(data->menu_conn_table), TRUE); gtk_widget_set_visible(GTK_WIDGET(data->menu_conn_table), TRUE);
gtk_widget_set_visible(GTK_WIDGET(data->pdc_details_menuitem), TRUE); gtk_widget_set_visible(GTK_WIDGET(data->pdc_details_menuitem), TRUE);
@ -1098,8 +1098,10 @@ void fill_pdc_details (char *filePath)
gtk_widget_set_sensitive(GTK_WIDGET(data->add_pdc_button), TRUE); gtk_widget_set_sensitive(GTK_WIDGET(data->add_pdc_button), TRUE);
gtk_widget_set_sensitive(GTK_WIDGET(data->remove_pdc_button), TRUE); gtk_widget_set_sensitive(GTK_WIDGET(data->remove_pdc_button), TRUE);
gtk_widget_set_sensitive(GTK_WIDGET(data->display_conn_table_button), TRUE); gtk_widget_set_sensitive(GTK_WIDGET(data->display_conn_table_button), TRUE);
gtk_widget_set_sensitive(GTK_WIDGET(data->utility_tools), TRUE);
// gtk_widget_set_visible(GTK_WIDGET(data->menuitem2), FALSE);
gtk_widget_set_visible(GTK_WIDGET(data->menuitem2), TRUE);
gtk_widget_set_visible(GTK_WIDGET(data->menu_conn_table), TRUE); gtk_widget_set_visible(GTK_WIDGET(data->menu_conn_table), TRUE);
gtk_widget_set_visible(GTK_WIDGET(data->pdc_details_menuitem), TRUE); gtk_widget_set_visible(GTK_WIDGET(data->pdc_details_menuitem), TRUE);

View File

@ -9,18 +9,11 @@
gboolean update_images(gpointer* pars){ gboolean update_images(gpointer* pars){
myParameters* parameters = (myParameters*) pars; myParameters* parameters = (myParameters*) pars;
struct data_frame *df = TSB[0].first_data_frame; struct data_frame *df = TSB[0].first_data_frame;
if(parameters->g_green_image == NULL){
return FALSE;
}
if (parameters->util_map == NULL){
return FALSE;
}
if (df == NULL){ if (df == NULL){
return FALSE; return TRUE;
} }
int freq = to_intconvertor(df->dpmu[0]->freq); int freq = to_intconvertor(df->dpmu[0]->freq);
gboolean green =attack_detect(df,&START,&COUNT,&SUM_OF_FREQUENCY); gboolean green =attack_detect(df,&START,&COUNT,&SUM_OF_FREQUENCY);
if(parameters->util_map != NULL){
// if(parameters->g_last_image != 0){ // if(parameters->g_last_image != 0){
// osm_gps_map_image_remove(parameters->util_map, parameters->g_last_image); // osm_gps_map_image_remove(parameters->util_map, parameters->g_last_image);
@ -28,7 +21,7 @@ gboolean update_images(gpointer* pars){
// if (freq > 300){ // if (freq > 300){
// parameters->g_last_image = osm_gps_map_image_add(parameters->util_map,15.518597, 74.925584, parameters->g_green_image); // parameters->g_last_image = osm_gps_map_image_add(parameters->util_map,15.518597, 74.925584, parameters->g_green_image);
// }else{ // }else{
// parameters->g_last_image = osm_gps_map_image_add(parameters->util_map,15.518597, 74.925584, parameters->g_green_image); // parameters->g_last_image = osm_gps_map_image_add(parameters->util_map,15.518597, 74.925584, parameters->g_red_image);
// } // }
if(parameters->g_last_image != 0){ if(parameters->g_last_image != 0){
osm_gps_map_image_remove(parameters->util_map, parameters->g_last_image); osm_gps_map_image_remove(parameters->util_map, parameters->g_last_image);
@ -38,8 +31,6 @@ gboolean update_images(gpointer* pars){
}else{ }else{
parameters->g_last_image = osm_gps_map_image_add(parameters->util_map,15.518597, 74.925584, parameters->g_red_image); parameters->g_last_image = osm_gps_map_image_add(parameters->util_map,15.518597, 74.925584, parameters->g_red_image);
} }
}
gtk_widget_queue_draw(GTK_WIDGET(parameters->util_map)); gtk_widget_queue_draw(GTK_WIDGET(parameters->util_map));
return TRUE; return TRUE;
} }

View File

@ -17,6 +17,13 @@
// osm_gps_map_image_add(map, lat, lon, image); // osm_gps_map_image_add(map, lat, lon, image);
// } // }
// on closing the window kill the g_timeout_add
void on_window_destroy(GtkWidget *widget, gpointer data)
{
g_source_remove(GPOINTER_TO_UINT(data));
gtk_main_quit();
}
void utility_tools(GtkButton *but, gpointer udata) void utility_tools(GtkButton *but, gpointer udata)
{ {
OsmGpsMap *util_map; OsmGpsMap *util_map;
@ -41,7 +48,7 @@ void utility_tools(GtkButton *but, gpointer udata)
util_map = g_object_new (OSM_TYPE_GPS_MAP, util_map = g_object_new (OSM_TYPE_GPS_MAP,
"map-source", OSM_GPS_MAP_SOURCE_GOOGLE_HYBRID, "map-source", OSM_GPS_MAP_SOURCE_OPENSTREETMAP,
"tile-cache", "/tmp/", "tile-cache", "/tmp/",
NULL); NULL);
osm_gps_map_set_center_and_zoom (util_map, 15.4589, 75.0078, 10); osm_gps_map_set_center_and_zoom (util_map, 15.4589, 75.0078, 10);
@ -50,12 +57,12 @@ void utility_tools(GtkButton *but, gpointer udata)
g_last_image = osm_gps_map_image_add(util_map,15.518597, 74.925584, g_green_image); g_last_image = osm_gps_map_image_add(util_map,15.518597, 74.925584, g_green_image);
myParameters parameters = {util_map, g_red_image, g_green_image, g_last_image}; myParameters parameters = {util_map, g_red_image, g_green_image, g_last_image};
gpointer data = (gpointer) &parameters; gpointer data = (gpointer) &parameters;
g_timeout_add(20, (GSourceFunc) update_images, data); guint pid = g_timeout_add(20, (GSourceFunc) update_images, data);
gtk_widget_set_size_request(GTK_WIDGET(util_map), 600, 500); gtk_widget_set_size_request(GTK_WIDGET(util_map), 600, 500);
gtk_container_add(map_container, GTK_WIDGET(util_map)); gtk_container_add(map_container, GTK_WIDGET(util_map));
g_signal_connect(window, "destroy", G_CALLBACK(gtk_widget_destroy), NULL); g_signal_connect(window, "destroy", G_CALLBACK(on_window_destroy), GUINT_TO_POINTER(pid));
gtk_widget_show_all(window); gtk_widget_show_all(window);
gtk_main(); gtk_main();